mgonto / restangular

AngularJS service to handle Rest API Restful Resources properly and easily
MIT License
7.87k stars 840 forks source link

getRestangularUrl() does not return parameters #421

Closed filiptc closed 10 years ago

filiptc commented 11 years ago

This is a feature request for the getRestangularUrl() method to return a full URL including the serialized url-encoded parameters (in case of GET).

I would find it very useful, especially for cache management. If you accept pull requests, I'd give it a try.

PS: I'm aware of the retrocompatibility issues that will arise (people relying on this method to return only the base URL without params), so maybe there could be a getFullRestangularUrl(), in order to maintain the original method's functionality for legacy purposes.

mgonto commented 11 years ago

Hey,

The thing is that the URL Params are sent actually when doing get or getList, the element itself doesn't have information about how it was get right now. Also, using that would mean that you wouldn't be able to get URLs for items if you actually did a GET on the list, right?

Anyway, I do accpet PRs, so you're welcome to do a PR a for this, but please explain a little what your approach will be, or just do it otherwise.

Thanks!

filiptc commented 11 years ago

Right, I'm aware of it only making sense after calling get/getList. I was imagining params being a stateful property of the restangularized data in those cases. Before calling these methods and for nested resources of collections it would be null.

For me, just being able to access the params (and headers?) the collection was requested with, would be nice enough. Getting the actual URL would really just be a goody.

mgonto commented 11 years ago

Makes sense. Im open to the PR but make a new function for this. Maybe getReauestedUrl?

— Mobile mail. Excuse brevity and typos.

On Fri, Nov 22, 2013 at 10:44 AM, Philip Thomas Casado notifications@github.com wrote:

Right, I'm aware of it only making sense after calling get/getList. I was imagining params being a stateful property of the restangularized data in those cases. Before calling these methods and for nested resources of collections it would be null.

For me, just being able to access the params (and headers?) the collection was requested with would be nice enough. Getting the actual URL would really be a goody.

Reply to this email directly or view it on GitHub: https://github.com/mgonto/restangular/issues/421#issuecomment-29073028

mgonto commented 10 years ago

Fixed with merged PR.