$http.get(url).success(function(){
...
$http.get(url).success(function(){
...
})
})因为里面的$http用到外面返回的值做地址参数,所以嵌套着写,但这样感觉不是很优雅,有没有一种方法解决,最好给示例......跪拜大神支招
1 回答
Helenr
TA贡献1780条经验 获得超4个赞
试试这个呢
$http({ method: 'GET', url: '/someUrl' })
.then(response => {
return $http({ method: 'GET', url: response.data.url }).catch(errHandle);
})
.then(p => {
console.log(p)
})
.catch(errHandle);function errHandle(err){
console.dir(err);
}添加回答
举报
0/150
提交
取消
