Monday, 15 July 2013

angularjs - AngularUI pattern to forward to url after login -


I have a scenario where a user can provide a URL:

  Http: // localhost: 8080 / # / component? ID = 1234  

The first thing of the AngularUI is whether the user is authorized or not. If it has not been authorized, then it has been forwarded to the login page using

$ state.go ("Login");

My intent

 $ rootScope Save the file to "Junk" I can not find a way to retain the URL with the query parameter component id id = 1234. Location or $ state. I can only find it to work with state name (using $ state), but Not with the parameter. 

not me Please know if your solution is best or not, but if you want to do this, you can just type a function like this:

  $ rootScope. $ ("$ StateChangeStart" , Function (event, toState, toParam, fromState, fromParams) {/ * your code is here}}  

and you can navigate to any position with any parameter like By doing something:

  $ state.go ("state_name", {parameter in the form of id e.g. id: 1234 * /});  

You can also read angular kutha-router Are the pages I hope I can answer your question.


No comments:

Post a Comment