Rutwick Gangurde Rutwick Gangurde - 1 year ago 190
AngularJS Question

AngularJs - Skip login page if already logged in

I have implemented an Authentication system for my app. I use

(in run) to check if the user is logged in and redirect him to login if not. This works fine. But, I can access the login page via the url, I want to send the user to the dashboard if he's already logged in. What is the proper way to do this?

Answer Source


$rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {}); 

Details here$location

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download