I'm trying to use the Component Lifecycle Hooks
and they seem to work BUT, i'm having problems with being redirected back to my login page.
I'm using the canActivate hook, and the code is quite simple.
this.checkLogin = $rootScope.loggedIn;
is set in the controller, where $rootScope.loggedIn is set in a factory which is called when the login button is clicked.
If the login data is correct i'm redirected using a $location.path("/dashboard") to the dashboard, if not well then the hook catches it, sees the value is false and stops the redirect.
But it does not return me to /login, but keeps me on /dashboard. but the html file loaded is still the login.html
Hi guys!
I'm trying to use the Component Lifecycle Hooks and they seem to work BUT, i'm having problems with being redirected back to my login page. I'm using the canActivate hook, and the code is quite simple.
this.checkLogin = $rootScope.loggedIn;
is set in the controller, where $rootScope.loggedIn is set in a factory which is called when the login button is clicked.
DashboardController.prototype.canActivate = function() { return this.checkLogin; }
If the login data is correct i'm redirected using a $location.path("/dashboard") to the dashboard, if not well then the hook catches it, sees the value is false and stops the redirect. But it does not return me to /login, but keeps me on /dashboard. but the html file loaded is still the login.html
Please help! :)