Reputation: 4928
I have a simple resource like.
angular.module('app').factory('nmCategory', function($resource){
var categoryResource = $resource('/api/categories/:id',{id:"@id"}, {
update: {method: 'PUT', isArray : false},
get: {method: 'GET' },
});
return categoryResource;
});
When I called nmCategory.query()
, i get all the result returned. However, i am trying to filter by id. Thats to the a single record ehre id is @id. I then try nmCategory.get({id: 1});
and to my surprise, it fails and returning
/api/categories/1 Not found (404)
I was expecting to get my single record my id . I searched through more examples online, yet none refute what i am doing. Please how do i achieve this? Any help would be appreciated.
Upvotes: 1
Views: 97
Reputation: 5176
Navigate to that URL in your browser and see if it works. It probably doesn't. This is most likely a back-end issue, not an Angular issue.
Upvotes: 2