I\'m writing a single page application in Angular, specifically angular.dart, but I\'m assuming this question still applies to AngularJS.
Take for example the followin
Well, I made a thing in Dart which is close to one of the previous solutions which don't really work. The main point is that in the RouteEventHandler
, you need to call the RouteEventHandler
of the view.
..addRoute(
name: 'userAdd',
path: '/userAdd',
enter: checkAuthentication(router,view,'view/addUser.html'))
..addRoute(
name: 'login',
path: '/login',
enter: view('view/login.html'));
}
RouteEventHandler checkAuthentication(Router router,ViewFactory view, String location){
return (RouteEvent e) {
if(_authenticationService.isAuthenticated()){
view(location)(e);
}else{
router.go("login",{});
}
};
}