restangular icon indicating copy to clipboard operation
restangular copied to clipboard

remove parent route after creating new resource

Open ashgibson opened this issue 11 years ago • 2 comments

My API looks like the following:

/jobs/xxx/invoices - POST (create a new invoice against a job)
/service-calls/xxx/invoices - POST (create a new invoice against a service call)
/invoices - GET, PUT/PATCH, DELETE (view, edit, update an invoice regardless of what it is attached too)

After I save/create a new invoice I don't want it to be a nested resource anymore. Currently I am just setting parentResource = null and this seems to work but just wanted to check if this is the best way.

ashgibson avatar Jul 13 '15 04:07 ashgibson

+1 When II POST to restangular resource got using restangular.get('user',111111) using User.post('app',{}) i get back an object that has no parent. (checking via parentResource property) I confirmed that when using restangular 1.4 I get the expected user parent, we will be happy to provide further info if needed

nadavsinai avatar Aug 11 '15 09:08 nadavsinai

+1 (but not exactly) Please check my question on SO: http://stackoverflow.com/questions/36344618/how-do-i-perform-specific-parentless-requests-using-restangular-in-a-neat-way

mspivak avatar Apr 26 '16 20:04 mspivak