I'm trying to figure out how to have my app check to see if a user is logged in and if so route them directly to the 'home' page and if not route the to the login page. I need the local storage data to be available across controllers so it seems like a service is the best fit for this. However, I'm having issues figuring out exactly how to do this with my current setup.
This is the idea: User logs in, auth info is stored in local storage object, they are redirected to 'home' page User closes browser and returns later, app check local storage to see if auth info exists If auth info exists user is automatically redirected to 'home' If auth info doesn't exist user is directed to login page There will be more views and controllers than just login and home and I will need local storage object accessible across all of them. I thought I could use one service to handle the auth in either situation but I cant' quite figure it out. Plunker: http://plnkr.co/edit/ZmrEiYRTB16J7LIEzR4n?p=preview Thanks. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
