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
之間填充?
對不起,這是一個錯字,你的迴應是我的代碼。 –