angular resource overwrite url not working
I have a very similar problem in my project. The url couldn't be overridden in resource actions. I am using Angular 1.2.0 and it should support the feature since 1.1.4. So I checked the Angular API reference, CHANGELOG, but no luck. Then I dug into the source code and noticed that the logic of overriding url isn't there. That's the root cause of the problem. I updated Angular to 1.2.0, but I forgot to update angular-resource.js
to the corresponding version.
So, long story short: check the version of angular-resource.js
I am not sure if you cann access properties of identity
in the url override, but you can try something like this:
return $resource("api/experiences/:id", {}, { queryAll : { method : 'GET', url : 'api/companies/:id/experiences', params : { id: identity.id }, isArray : true }});
The id: identity.id
tells angular to use the id property of identity
, (if it exists).