-
Notifications
You must be signed in to change notification settings - Fork 27.4k
extract url parsing / composing into reusable service #738
Comments
+1 :) |
+1 |
2 similar comments
+1 |
+1 |
This is a nice idea, would it be a good idea to expose this service on $location and also allow parsing of url strings without actually changing the location (if you pull one from an iframe for example)? |
+1 |
1 similar comment
+1 |
+1 would love to see something as powerful as http://medialize.github.com/URI.js/ rolled into $location |
+1 |
1 similar comment
+1 |
+1, one of my template needs this right now to massage some urls |
+1 |
+1 |
I would like to have this. It can't be difficult to implement. $resource has the same system (Route.setUrlParams). |
Made some code to solve this problem. It would be better when this was native angular code. https://github.com/eonlepapillon/parametrizedLocation |
👍 |
1 similar comment
+1 |
I have been using https://github.com/fxa/uritemplate-js it is based on RFC6570 Another popular one is https://github.com/medialize/URI.js the only issue is the RFC uses
|
+1 |
1+ |
+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 similar comment
+1 |
+1. Or more. |
+1 |
Is there any progress on this one? |
+1 |
OK, so we have agreed to expose the |
This service exposes the underlying helper that `$resource` uses to compose resource request URLs. The behaviour of the composition has not changed although there is one minor internal refactoring: previously additional parameters were passed through to the `$http` service to be serialized and added to the URL at a later stage. Now these parameters are added in place - using the `$httpParamSerializer` in case it has been replaced or decorated. Closes angular#738
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 |
@petebacondarwin that's a neat suggestion. Thank you very much. I will opt for this (and I totally understand the decision). |
something like this:
$route does similar (reverse) stuff when parsing an url into params...
The text was updated successfully, but these errors were encountered: