AngularJS应用是完全运行在客户端的应用。没有后端的支持,我们只能展示随页面一起加载进来的数据。AngularJS提供了几种方式从服务器端获取数据。

$http服务

$http 封装了浏览器原生的XMLHttpRequest对象。

var promise = $http({
                     method:'Get',
                     url:'/api/cars.json'
                    });
                    

可以使用then处理回调,或者直接使用success 和error.

$http 提供一些快捷方法

var promise = $http.get('/api/cars.json');

拦截器来做一些全局的处理

Note:

应用可以由一个或者多个模块组成。

Angular JS [Draft]的更多相关文章

  1. MVC、MVP、MVVM、Angular.js、Knockout.js、Backbone.js、React.js、Ember.js、Avalon.js、Vue.js 概念摘录

    注:文章内容都是摘录性文字,自己阅读的一些笔记,方便日后查看. MVC MVC(Model-View-Controller),M 是指业务模型,V 是指用户界面,C 则是控制器,使用 MVC 的目的是 ...

  2. angular.js:13920 Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- testServe

    angular.js:13920 Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- testSer ...

  3. (翻译)Angular.js为什么如此火呢?

    在本文中让我们来逐步发掘angular为什么如此火: Angular.js 是一个MV*(Model-View-Whatever,不管是MVC或者MVVM,统归MDV(model Drive View ...

  4. angular.js写法不规范导致错误

    以下写法:没有明确指定module和controller,写法不规范. 更改angular.js版本会出bug. <html ng-app> <head> <title& ...

  5. Angular.js实现折叠按钮的经典指令.

    var expanderModule=angular.module('expanderModule',[]) expanderModule.directive('expander',function( ...

  6. Angular.js通过bootstrap实现经典的表单提交

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel= ...

  7. python , angular js 学习记录【1】

    1.日期格式化 Letter Date or Time Component Presentation Examples G Era designator Text AD y Year Year 199 ...

  8. Angular JS 学习之路由

    1.AngularJS路由允许我们通过不同的URL访问不同的内容:通过AngularJS可以实现多视图的单页WEB访问(SPA) 2.通常我们的URL形式为http://runoob.com/firs ...

  9. Angular JS 学习之Bootstrap

    1.要使用Bootstrap框架,必须在<head>中加入链接: <link rel="stylesheet" href="//maxcdn.boots ...

随机推荐

  1. GIT文件的三种状态

    对于任何一个文件,在 Git 内都只有三种状态:已提交(committed),已修改(modified)和已暂存(staged).已提交表示该文件已经被安全地保存在本地数据库 中了:已修改表示修改了某 ...

  2. linux awk, xargs

    awk , 很赞的教程:http://coolshell.cn/articles/9070.html xargs, http://blog.csdn.net/andy572633/article/de ...

  3. backbone & django csrf_token的问题

    由于这个加入了token的验证,因此在backbone调用Model/Collection的save时会失败,错误403.(这里不讨论劫持重发的问题) 解决方案是:修改xmlHttpRequest的h ...

  4. Discovering versions from the identity service failed when creating the password plugin.

    If you are behind the proxy, then you have to set no_proxy environmental variable for your localhost ...

  5. Course Schedule I & II

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  6. 【leetcode】Scramble String

    Scramble String Given a string s1, we may represent it as a binary tree by partitioning it to two no ...

  7. C#跨线程操作控件

    1.首先通过按键创建子线程: 创建子线程,子线程调用changeText方法. private void btnOK_Click(object sender, EventArgs e) { Threa ...

  8. C# 数据库查询总结

    首先创建了一个SQL Server数据库作为测试的数据库,建立表并填入测试数据 数据库:SQL Server 数据库名:Blog 表名:Test 注:数据库的连接可以使用“dbl”文件测试,具体使用百 ...

  9. default constructor,copy constructor,copy assignment

     C++ Code  12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 ...

  10. Failed to issue method call: Unit httpd.service failed to load: No such file or directory.

    centos7修改httpd.service后运行systemctl restart httpd.service提示 Failed to issue method call: Unit httpd.s ...