I wish to create a simple authentication check for my routes by external service.
I define the access requirements on the route object:
$routeProvide
Use $routeProvider resolve
.when('/', { templateUrl: 'src/app/views/index.html', controller: 'indexCtrl', resolve: function($q, $location) { var deferred = $q.defer(); deferred.resolve(); if (!isAuthenticated) { $location.path('/login'); } return deferred.promise; } })