I have a fairly simple angular app (working off the MEAN stack) that is not using the ui-router (and I would like to keep it that way for right now).
I am wondering what the best way to share a users "logged in" status across the app is.
For instance, I would like a directive to show "Signup or Login" if the user is not logged in, or "Hello, username" if the user is logged in.
Throughout my app, many directives refer to the logged in status and so it seems that using multiple Controllers and declaring a logged in $scope property on each one is not the best idea. How could I achieve this?
As a follow up, any recommendations on the best way to know if a user is logged in or not? Right now I am basing it off an auth-token that is stored in local storage, but it could be cookies as well.
I would like to know a/the best practice way that I could store more than a user's logged in status but also their information (name, items picked out etc.) and keep it synced to my server (so if they log in on another computer, their cart would persist).
Thanks