javascript - AngularJS Resource not using ID on update -


i have pretty basic factory:

app.factory('person', function($resource) { return $resource(api_route+'/people/:id.json', {   id: "@id" }, {   update: {     method: "put"   } }); }); 

it performs get request specified url expected, when tried update, goes /people.json instead of /people/:id.json.

person.get({   id: personid }, function(person) {   return $scope.person = person; });  $scope.person.$update() 

the response server logs:

started put "/hr/angular/people.json" 128.104.86.165 @ 2015-04-14 14:12:30 -0500  actioncontroller::routingerror (no route matches [put] "/angular/people.json"): 

i tried different way of doing update command got same response.

person.update($scope.person, function(person) {   console.log($person); }); 

if hardcode id resource path, $resource(api_route+'/people/1234.json'), i'm able expected actions on individual, including update. don't see i'm missing allow get method of resource use proper path not update.

you need pass id update method don't you?

$scope.person.$update({ id: 1 }, function(response) {     // }); 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -