最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
angularjs $http调用接口的教程
时间:2018-08-14 编辑:猪哥 来源:一聚教程网
如下所示:
$http.get("/merchantmall/merchant.json") .success(function(data, status, headers, config) { console.log(arguments); }) .error(function(data, status, headers, config) { console.log(arguments); })
$http({url: "/merchantmall/merchant.json", }) .success(function(data, status, headers, config) { console.log(arguments); }) .error(function(data, status, headers, config) { console.log(arguments); })
var promise = $http({ method: 'GET', url: '/api/users.json' }); promise.then(function(resp) { // resp是一个响应对象 }, function(resp) { // 带有错误信息的resp });
var promise = $http({ method: 'GET', url: '/api/users.json' }); promise.success(function(data, status, headers, config) { // 处理成功的响应 }); promise.error(function(data, status, headers, config) { // 处理非成功的响应 });
相关文章
- js实现音乐播放器代码展示 10-12
- js实现图片查看器代码展示 10-12
- JS中switch的四种写法介绍 10-12
- js实现新闻轮播效果教程 10-11
- JS实现简单的图片切换功能教程 10-11
- js实现下拉刷新和上拉加载解析 09-28