I have an AngularJS app running on a node/express backend. I'm using passport for user authentication.
When a user signs in or signs up, my angular controllers communicate with express via $http ajax/xhr calls. The form data is sent, node/express/passport process the data, and they return json data with the user's info (i.e. username).
Angular then uses the user info to update my templates, i.e. {{user.username}}
The problem is that if the user refreshes the entire page, Angular loses this user information. They're still logged in - req.user still contains their info - but angular doesn't know about it.
I'd like to avoid an ajax call just to check if the user is logged in. That'll be an extra http call every new visit...
I can pass the user data to the jade template directly, but that can't be updated by angular later.