最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
angularjs $http调用接口的教程
时间:2022-06-25 15:49:13 编辑:袖梨 来源:一聚教程网
如下所示:
$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) {
// 处理非成功的响应
});
相关文章
- PHP addcslashes()函数讲解 05-31
- SQL+HTML+PHP 一个简单论坛网站的综合开发案例(注册、登录、注销、修改信息、留言等) 05-31
- 燕云十六声春节版本攻略 霜催落月桃靥剑姬天赋怎么做 05-31
- Transformer在数独求解中线性表示高度结构化世界模型 05-31
- maya软件对电脑配置要求 05-31
- Navicat如何加密备份文件 05-31