[Fixed]-AngularJS Logging Out and Logging back in

1👍

The problem is not with ng-if as far as I can see. When you clear your token, you should also clear the user object that you use to populate your DOM. Right now there’re two dependencies – the cookie and the user object.

When you remove the token, make sure you clear the user object. If the ng-if is dependent only on your token, that means that during the gap between your login and your user object’s population, the old user object will still be valid and the $hide would be false, thereby showing your old user data

Leave a comment