Closed MatthewVita closed 8 years ago
@dmtroyer, @whit537 before I start a PR, are you guys cool with this design? There a few other ways to do it (hacking ng-route
to accept an authenticatedRoute
boolean property in a granular way, for example).
This works for me. I recall reading about a more granular method using angular-ui-router, as well.
Works for me.
In
index.js
run(...)
block, inject ourAuthService
and listen on$routeChangeStart
to see if route contains "dashboard". If so, invokeAuthService.isAuthenticated()
to ensure user can be routed.popular design here: http://stackoverflow.com/a/20971528 (ours is going to be much simpler b/c we can assume 'dashboard' routes are the only ones that need whitelisted)