Joined January 2014
·

yoerlemans

Belgium
·
·

As said in the post, you can't do "event.preventDefault()" inside the routeChangeStart handler. But the code isn't flawless. As some other people suggested, it's not that clean to have a global variable with your routes. What we did was define a constant in Angular ( myApp.constant('routes', {}) )

Another problem with the code described here is when I have a route with parameters.
route = "/myPage/:id"
next = "/myPage/4"
indexOf will return -1 and it'll fail

/* Edit */
You can't get the constants when in a run block so that would not work in this situation.

Achievements
9 Karma
0 Total ProTip Views
Interests & Skills