javascript - ngResource route not formatted as expected -
i have service uses ngresource talk rest api:
'use strict'; angular.module('accountmanagement').factory('accounts', ['$resource', function($resource) { return $resource('api/accounts/:accountid', { accountid: '@_id' }, { update: { method: 'put' } }); }]);
and have update function looks this:
$scope.update = function() { // alert($scope.editaccount); var $aid = $scope.editaccount._id; var acc = $scope.editaccount.tostring(); accounts.update({id:$aid}, acc); };
the problem restapi expects route formatted like: /api/accounts/account_id
but instead being formatted like: /api/accounts?id=account_id
giving me 400 error. i'm pretty new angular haven't managed find problem in documentation.
Comments
Post a Comment