我收到以下错误:
TypeError: Cannot call method 'then' of undefined
在这段代码上:
App.controller('MainCtrl', ['$scope', 'Main', 'MainFilter', function($scope, Main, MainFilter) {
$scope.scope_variable = Main.query().$promise.then( function(result) { MainFilter.do_something(result) } );
}]);
App.factory('Main', ['$resource', function($resource) {
return $resource('/main_resource.json')
}]);
我一直在尝试遵循这些在控制器中使用 promise 的其他示例(我没有使用 $routeProvider),但似乎没有任何效果。