分毫不差我有如下我的應用程序設置:角資源計時問題
var myApp = angular.module('app', []);
myApp.factory('MotorList', ['$resource', function($resource) {
return $resource(baseURL + 'MotorList.json', {}, {});
}]);
myApp.factory('MotorDataManager', function(MotorList) {
var List;
MotorList.query().$then(function(value){
List = value.data;
})
return {
getFullList: function() {
return List;
}
anotherFunction: function { ... }
}
});
myApp.controller('MainCtrl', function($scope,MotorDataManager){
$scope.tableData = MotorDataManager.getFullList();
})
在我的前端我有一個NG-重複,通過$ scope.tableData循環。 但是我面臨的問題是$ scope.tableData永遠不會呈現。資源工作正常。它確實返回數據,但我覺得這是一個計時問題,但我不知道如何解決它。
嘿,我對angular的.query()函數的理解將返回索引。是否有一個特別的原因,你必須編寫自己的方法? –
Angular的查詢返回資源對象 – runtimeZero
也可以提供你的html模板嗎? –