Restangular, is it possible to do a Post without a previous reading?


In the documentation’s examples, each POST is preceded by a reading, is it possible to do a Post without this previous step?



Restangular need to know to which resource you are going to post, this is a required step, otherwise it won’t be able to generate the url.

To not get data, you just need to not use get() or getList() methods.

So any of those should work :

var account = Restangular.service("accounts");{data});

var account Restangular.oneUrl('googlers', '');{data});

// the 'one()' method will allow you to use '' later which will decide to POST or PUT accordingly
var account ="accounts");{data});

Answered By – Salem Ouerdani

Answer Checked By – David Goodson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.