Hey everyone,
I'm facing a situation where I need to display certain UI elements based on whether a session is active or not.
I initially tried using a directive for this purpose, and while it worked well, I encountered an issue where the directives wouldn't update after a successful login.
Previously, my code looked like this:
<ul class="nav navbar-nav navbar-right" ng-hide="vm.model.currentUser.id !== 0">
To improve clarity and organization, I decided to move the logic of checking the session status into a custom directive called:
<ul class="nav navbar-nav navbar-right" !ap-valid-login-session>
I have two questions regarding this approach:
- Do you think this method is correct, or do you have any suggestions for a better alternative?
- If this method is appropriate, how can I ensure that the directive gets recomputed when needed?