0
我正在做一個函數,使一個http GET請求,然後使用該響應的一部分,以另一個http GET請求。但是,第一個http GET請求返回的數據被包含在許多不必要的數據中(可能是它的承諾對象),但我只需要它的json組件。如何在控制器中訪問我的響應的json數據?這是我的代碼。
$scope.doSearch = function() {
var upcResult = Restangular.one('upc',$scope.searchTerm).get()
//the upc returns an item, so i am trying to access that part of the json by using
upcResult.item, how if I console.log that it is undefined
$scope.doAnotherSearch = function() {
var itemResult = Restangular.one('item',upcResult.item).get();
}
感謝您的幫助,我是無法理解的承諾。 – Wes
看到這個簡短的文檔:http://urish.org/angular/AngularPromises.pdf –