Currently, I am implementing ui.router and integrating my navigation in the main HTML file as shown below:
<header ng-if-start="logedin()"></header>
<navigation ng-if-end="logedin()"></navigation>
The logedin()
boolean value is determined by a function within the angular.module().run()
:
$rootScope.$on('$stateChangeStart', function(e, to)
If a user clicks on logout within the navigation, it triggers this function within the controller:
$scope.logout = function() {
store.remove('jwt');
$state.go('login');
}
However, an issue arises where the navigation does not hide after the $state.go
until the page is refreshed.
I'm wondering if I need to re-render the main index template/view (and if so, how?) or what other solutions are available to solve this problem?