Thursday, 15 August 2013

javascript - How to get Restangular to PUT without ID? -



javascript - How to get Restangular to PUT without ID? -

i'm working on front-end web application has unorthodox "restful" back-end. crud actions this:

model :id post {payload} set {payload} delete :id

in other words, set action not have id. instead, back-end retrieves id payload object. creates problem when restangular attempts generate url single resource:

restangular.one('model', 2).get().then ($model) -> $model.name = 'newname' $model.save()

the request generated restangular is, of course:

put /model/2

when need be

put /model

is there programmatically reliable way accomplish this? applies updating records. thanks!

you can this:

restangular.one('model').customput($model.plain());

with above code , restangular.service , restangular.extendmodel can define own save().

javascript angularjs rest restangular

No comments:

Post a Comment