Join the Stack Overflow Community
Stack Overflow is a community of 6.3 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have an angular application working with angular ui-router. When I run the application from server the url is like localhost/..../index.html

After I click on any state the url changes to localhost/.../index.html#[whateverStateClicked] which is normal.

But now I wanted to add some application specific custom string after index.html something like this localhost/.../index.html/appString when the application starts and something like localhost/.../index.html/appString#[whateverStateClick] upon click of any state and want the application to function in the same way as when the appString is not present.

This appString will be updated during the usage of application or simply bound to a scope variable for updation which shouldn't affect the normal flow.

share|improve this question
    
Sample plunk: plnkr.co/edit/Xw408MLlce36s3sxjFCl?p=preview – user3295791 Sep 27 at 0:46
    
You need to look into routing with parameters. Check out this answer. – Evilzebra Sep 29 at 18:45
    
Thanks @Evilzebra $routeParams helped me solve the problem – user3295791 Oct 5 at 14:16
    
No problem! Would be appreciated if you could accept my answer. – Evilzebra Oct 9 at 13:07

You can send and receive custom variables within the URL by using $routeProvider and $routeParams.

Setup the router with/your/:customVariable and you can easily set your custom string.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.