Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverse routes #38

Closed
caullla opened this issue Apr 24, 2014 · 3 comments
Closed

reverse routes #38

caullla opened this issue Apr 24, 2014 · 3 comments

Comments

@caullla
Copy link

caullla commented Apr 24, 2014

Hi,
It would be very nice if you add some reverse functions.
I created something similar in my last project. And it looks like this one.

  1. resolve - service, which have 2 methods. href and hash.

    > resolve.href( "route.name", [arg1, arg2] ) 
    /route/name/arg1/arg2/
    > resolve.hash( "route.name", [arg1, arg2] ) 
    #!/route/name/arg1/arg2/
    
  2. url - filter.

    {{ "route.name" | ulr: [arg1, arg2] }}
    returns resolve.hash( "route.name", [arg1, arg2] )
    
  3. redirectTo service

    redirectTo( "route.name", [arg1, arg2] )
    returns $location.path(resolve.href( "route.name", [arg1, arg2] ))
    

make sense?

@artch
Copy link
Owner

artch commented Apr 24, 2014

You created thins using route-segment or on your own?

There are some questions regarding such reverse mechanics. For example, what if multiple routes resolve to the same segment, which route should be resolved from this segment?

@caullla
Copy link
Author

caullla commented Apr 24, 2014

I see what you mean, but I didn't had this problem yet.
I'm new to angularjs, so I'm pretty sure that my solution isn't best.
I just use your rout-names.
http://pastebin.com/8twtTDU9

For now I have one problem, I can't determine hashPrefix, "#" or "#!". I checked source code, and it is not possible to get hasPrefix variable from outside.

@caullla caullla closed this as completed Apr 24, 2014
@caullla caullla reopened this Apr 24, 2014
@artch
Copy link
Owner

artch commented May 15, 2014

This proposal implemented in 1.3.0. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants