New to Angular -
Using $resource to query all records from a MongoDB model using mongoose. Does not execute callback. Explain how to set this up.
Here's the controller code.
MyService.recordCount.query( function(response){
console.log(response); // -----> Does not execute
$scope.count = response.length;
});
Service code is:
angular.module('myModule').factory('MyService', ['$resource',
function($resource) {
return {
recordCount:
$resource('/mymodule/recordCount'),
};
}
]);
Note: The DB call returns appropriate data, but controller code fails to call the callback in query().
Please explain why.