OK, I am back. Here's the demo app: http://witoldsz.github.io/angular-http-auth/ The idea is: the SPA app has only one root template (the index.html). The login form is there, ready to pop up any time. You just make it invisible when it's not needed. On the other hand, we have everything else: the application with menus, headers, footers, routes and whet else. On the to of both of them is a simple directive which is responsible for showing and hiding them when appropriate, so they are never both visible at the same time.
The additional bonus of this solution is that you can implement the resumable workflow, immune to losing of session, because showing the login page DOES NOT change the state of scopes and controllers. Users can be in the middle of something when they loose their sessions, the login incident can happen and after it's all OK, they can continue their job. Regards, Witold Szczerba 2014-05-24 12:23 GMT+02:00 Witold Szczerba <[email protected]>: > Hi guys, > I think you are extremely overcomplicating this all. > Check out the demo of my http-auth-module.... (focus on the showing login > form mechanism). Can't write now, will continue within few hours. > > Regards, > Witold Szczerba > --- > Sent from my mobile phone. > > On May 21, 2014 6:08 PM, "Stephen Adams" <[email protected]> wrote: >> >> Hi, >> >> I'm working on first big AngularJS project and one of the first tasks I'm >> tackling is creating the login mechanism. The way I want the page to work >> is, when the user is logged out they see the main login screen, once they >> have successfully logged in the main template shows the full application UI >> (header, navigation etc). >> >> So far I have created all my pages to load through ngView, but when I load >> the loginView I still have all the UI components in the main template >> (navigation etc). My plan was to create a login service that, for now, just >> checks that the user has submitted the login details. Then is sets a >> property of 'loggedIn'. >> >> I was then going to use this loggedIn property to check against in each UI >> element, so if loggedIn == true the ng-show will display the UI element if >> not the the UI element is hidden. >> >> The main problem I'm trying to tackle is have one main template and >> loading the login as a view within that template. Ideally I'd have two >> templates, one for the loggin and one for the main template. >> >> Any suggestions on the approach I'm taking? >> >> Thanks >> >> Stephen >> >> -- >> 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/d/optout. -- 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/d/optout.
