分毫不差我有如下我的应用程序设置:角资源计时问题
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模板吗? –