0
我拨打了一个获取电话并检索了一些我想用来拨打另一个拨打电话的数据,并将该数据放入$scope
中。像这样的东西。
$http.get('api/url/items').then(function(res){
$scope.items = res.data;
$http.get('api/url/names/' + res.data[0].id).then(function(res){
console.log(res.data.name);
$scope.name = res.data.name;
}
}
的$scope.items
被填充,但$scope.name
不是。 console.log
提供了正确的数据,但似乎在渲染后的视图之后。在呈现视图之前,如何获得第二个$http.get
以在$scope
之间填充?
对不起,这是一个错字,你的回应是我的代码。 –