With the use of ui-router
, a state is created with a resolve function:
.state('tab.social', {
url: '/social/',
views: {
'menuContent': {
templateUrl: 'templates/social/tab-social.html',
controller: 'SocialCtrl',
resolve: {
socialAuthResolve: socialAuthResolve
}
}
}
})
The resolve is then captured in the controller like this:
.controller('SocialCtrl', function($scope, SocialAuth, socialAuthResolve) {
//
console.log(socialAuthResolve);
//
$scope.logOut = function() {
SocialAuth.logOut();
$state.go('tab.social', {}, {reload: true});
};
//
$scope.logIn= function() {
SocialAuth.logIn();
$state.go('tab.social', {}, {reload: true});
};
})
However, after clicking either the logOut
or logIn
buttons, the state does not refresh. The resolve parameters from socialAuthResolve
are still using old values instead of updating. The only way to see changes is by manually refreshing the browser. Is there a way to force a refresh of the page after these actions, for example, by triggering the resolve again?