Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

extract url parsing / composing into reusable service #738

Closed

Description

@vojtajina

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...

Activity

  1. witoldsz commented on Mar 21, 2012

    @witoldsz

    +1 :)

  2. m6w6 commented on Jul 9, 2012

    @m6w6

    +1

  3. niklasbulitta commented on Jul 31, 2012

    @niklasbulitta

    +1

  4. bsr203 commented on Oct 6, 2012

    @bsr203

    +1

  5. iwein commented on Nov 12, 2012

    @iwein
    Contributor

    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)?

  6. georgiosd commented on Feb 26, 2013

    @georgiosd

    +1

  7. dmitryevseev commented on Feb 28, 2013

    @dmitryevseev

    +1

  8. tanepiper commented on Feb 28, 2013

    @tanepiper

    +1 would love to see something as powerful as http://medialize.github.com/URI.js/ rolled into $location

  9. snichme commented on Mar 27, 2013

    @snichme

    +1

  10. brettlaforge commented on Apr 18, 2013

    @brettlaforge

    +1

  11. coli commented on Apr 29, 2013

    @coli

    +1, one of my template needs this right now to massage some urls

  12. Leksyk commented on May 17, 2013

    @Leksyk

    +1

  13. eyelidlessness commented on Jul 28, 2013

    @eyelidlessness

    +1

  14. pahlers commented on Sep 5, 2013

    @pahlers

    I would like to have this. It can't be difficult to implement. $resource has the same system (Route.setUrlParams).

  15. pahlers commented on Sep 16, 2013

    @pahlers

    Made some code to solve this problem. It would be better when this was native angular code.

    https://github.com/eonlepapillon/parametrizedLocation

  16. 7 remaining items

  17. johncrim commented on Nov 8, 2015

    @johncrim

    +1

    URL is not a standard javascript class, so this really should be a core angular service, to avoid many duplicates of similar logic.

  18. STOpandthink commented on Jan 14, 2016

    @STOpandthink

    +1

  19. tools4origins commented on Feb 24, 2016

    @tools4origins

    +1

  20. andy-rush commented on Mar 1, 2016

    @andy-rush

    +1. Or more.

  21. chetankhilosiya commented on Apr 13, 2017

    @chetankhilosiya

    +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.

  22. pashchuk commented on Jan 26, 2018

    @pashchuk

    Is there any progress on this one?

  23. panlina commented on Mar 5, 2018

    @panlina

    +1

  24. petebacondarwin commented on Mar 5, 2018

    @petebacondarwin
    Contributor

    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.

  25. added a commit that references this issue on Mar 7, 2018
    34b0777
  26. Narretz commented on Jul 4, 2018

    @Narretz
    Contributor

    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.

  27. petebacondarwin commented on Jul 5, 2018

    @petebacondarwin
    Contributor

    @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.

  28. gilbsgilbs commented on Jul 5, 2018

    @gilbsgilbs

    @petebacondarwin that's a neat suggestion. Thank you very much. I will opt for this (and I totally understand the decision).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions