angularjs - Using put() in Restangular -
this coding
angular.module('app', ['restangular']) .config(function(restangularprovider) { restangularprovider.setbaseurl('http://www.abc.local'); }) .controller('updatecontroller', function($scope, restangular) { $scope.getemployee = function() { var employee = restangular.one('employee', 10002); employee.get().then(function(employee) { $scope.employee = employee; var editemployee = employee; editemployee.first_name = 'xxx'; editemployee.put(); }) } }); using employee.get(), restangular made me get http://www.abc.local/employee/1002, worked fine here
but using editemployee.put(), restangular made me put http://www.abc.local/employee instead of put http://www.abc.local/employee/10002, went wrong here?, please help
thanks

the application work on uses "customput" that:
restangular.all('groups').customput($scope.group).then(function() { $scope.servercalldone(); }, function() { $scope.servercallerror(); }); and server side:
@provider @path("groups") public class groupsrestfacade { @put @consumes({"application/xml", "application/json"}) @transactional public void edit(groupdetail _group, @context httpservletrequest req) { // . . . } } we not need rest parameter specify id, since id contained in sent object.
Comments
Post a Comment