Managing authentication
Managing an Angular application authentication is a complex issue. The problem is that while the server holds the information about the authenticated user, the Angular application is not aware of that information. One solution is to use a service and ask the server about the authentication status; however, this solution is flawed since all the Angular components will have to wait for the response to return, causing inconsistencies and development overhead. This can be solved using an advanced Angular router object; however, a simpler solution would be to make the Express application render the user
object directly in the EJS view and then use an Angular service to serve the object.
Rendering the user object
To render the ...
Get MEAN Web Development - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.