私は以下のようにアプリケーションをセットアップしています:
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();
})
私のフロントエンドには、$scope.tableData をループする ng-repeat があります。ただし、私が直面している問題は、 $scope.tableData がレンダリングされないことです。リソースは正常に動作しています。データは返されますが、これはタイミングの問題だと思いますが、解決方法がわかりません。