I am trying to implement promises in angularjs resource.But it is showing TypeError: Cannot read property 'then' of undefined
error. AngularJs version :v1.2.2
What i have done is
Controller
LibrariesFactory.getLibraryId({
"communityId": $scope.communityId
}).$promise.then(function(successResponse) {
console.log(successResponse);
}, function(errorResponse) {
});
Service
serviceApp.factory('LibrariesFactory', function($resource, AppSettings) {
return $resource(AppSettings.stub_url + 'v1/communities/:communityId/libraries', {
communityId: '@communityId'
}, {
getLibraryId: {
method: 'GET',
isArray: true
}
});
});
Any Ideas???