Sunday, 15 May 2011

javascript - Redirect after URL changes on $stateChangeStart event? -


I have some arguments on the $ stateChangeStart event, to check that the parameter (URL) is. If it is not, I want to redirect it to the 404 view:

  event.preventDefault (); $ State.go ('404');  

But this solution is wrong, because if you are moving between the states, and the 404 error occurs, then it's 404 Redirects to the view, but the URL is still on the working page, because it is a $ stateChangeStart event (it was not transferred to the state with a problem and this URL did not change) < Strong> This might be event.preventDefault () . Due to

I can not use the $ stateChangeSuccess event.

So what should I do in place of event.preventDefault () to achieve my goal?


No comments:

Post a Comment