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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -