-
-
Save raphaelnikson/25dd7492412cfbb3937746fcade2aae6 to your computer and use it in GitHub Desktop.
AngularJS: On route change start - Check if user has permission to proceed or redirect it to the Sign In page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.run(function ($rootScope, $location, AuthenticationModel) { | |
| // Register listener to watch route changes. | |
| $rootScope.$on('$routeChangeStart', function (event, next, current) { | |
| if (!AuthenticationModel.isSignedIn() && next.requireAuthentication === true) { | |
| $location.path('/signin'); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment