最新下载
热门教程
- 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) {
// 处理非成功的响应
});
相关文章
- 哔哩哔哩官网网页版官方入口-哔哩哔哩网页版直播互动专区 12-16
- 魔兽世界怀旧服Plus灰谷战场声望最新速刷方法 12-16
- 蛋仔派对云游戏秒玩入口-2026全新蛋仔派对网页版即点即玩地址汇总 12-16
- 魔兽世界怀旧服Plus战歌峡谷声望速刷攻略 12-16
- 番茄小说免费版畅读入口-番茄小说免费版极速轻量阅读入口 12-16
- 魔兽世界怀旧服Plus银翼要塞声望速刷攻略 12-16