Encountering the following error:
TypeError: Cannot call method 'then' of undefined
while working with the code below:
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')
}]);
Despite attempting to implement promise handling within the controller, following guidelines from various sources, the issue remains unresolved.
AngularJS using $resource service. Promise is not resolved by GET request
AngularJS resource promise