angularjs - angular $resource `user.$update()` is not found -



angularjs - angular $resource `user.$update()` is not found -

i have click handler changes active flag true. user.$update() doing post not put.

what proper (angular) way update user object using $resource?

$scope.setactive = function(user) { user.get({ id: user._id }, function(user){ user.active = true; user.$update(); }); };

my express route should watching put:

router.put('/:id', auth.isauthenticated(), controller.update);

you can alter method of $update function put when you're creating service/factory:

angular.module('app.services').factory('user', function($resource) { homecoming $resource('/api/users/:id', { id: '@_id' }, { update: { method: 'put' // method issues set request } }); });

check link more info.

angularjs angular-resource

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -