Hello everyone. I'm using ngResource to build a RESTful app. I've been reading a lot and couldn't find the answer to my question. Sorry if it's too n00b :)
I'll try to keep this generic so it might be useful to other people. Suppose you've got a Car resource. The uri is `/api/v1/car/:id/` To create a resource you POST your (json) data to `/car/` and (if successful) returns a 201 CREATED response along with some headers. Among those headers there's Location, which has something like this: `/api/v1/car/32/`. That way you know that the resource you just created got the ID 32. How do you get that "32" (the ID) using ngResource? Please note *you don't specify the ID when you're posting*. The server will tell you which id it assigned to your resource when it's created (and it'll be returned in the Location header). Here's roughly some code related to my question: http://jsfiddle.net/1k36q5qz/ Thank you very much for your help. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
