AngularJS | handle routing before they load
问题 I wish to create a simple authentication check for my routes by external service. I define the access requirements on the route object: $routeProvider .when('/', { templateUrl: 'src/app/views/index.html', controller: 'indexCtrl', authenticated: true }) .when('/login', { templateUrl: 'src/app/views/login.html', controller: 'loginCtrl', anonymous: true }) .otherwise({ redirectTo: '/' }) ; Then, I check if I have permission within the $routeChangeStart event. $rootScope.$on('$routeChangeStart',