extract url parsing / composing into reusable service
something like this:
compose(/path/:verb, {verb:'greet', salutation:'Hello'});
// results in URL /path/greet?salutation=Hello
$route does similar (reverse) stuff when parsing an url into params...
+1
URL is not a standard javascript class, so this really should be a core angular service, to avoid many duplicates of similar logic.
+1
+1
+1. Or more.
+1 The valid use case I have is, I need to check the length of url generated for GET request before making request, as some urls generated are too long due to request params has list that grows big.
Is there any progress on this one?
+1
OK, so we have agreed to expose the setUrlParams function as a service on the ngResource module. We do not want to add it to the core AngularJS module as it would add unnecessary code to that file.
We've decided not to add this after all, as only a small number of people would benefit from the option to manipulate url params in resource. And we don't want to expose a general url composition service in AngularJS as core should cater specifically to the needs of the framework.
@gilbsgilbs - since we are entering LTS mode the code for manipulating the URLs internally in AngularJS is not going to change (or at least it is very very unlikely to change). So it is pretty easy and safe to copy the code from angular-resource.js and reuse it in your own applications.
@petebacondarwin that's a neat suggestion. Thank you very much. I will opt for this (and I totally understand the decision).