In my app i want to check if user is logged in , so i can enable or disable buttons in menu. I can do it in a simple way, but then i get a problem that menu makes a "blink" where users will see some menu items until reponse from ajax is there.
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
$http.get('api/users/userLoggedIn').then(function(data){
console.log(data);
$scope.userLoggedIn = data;
});
});
thats what i came up with, if i folow documentation .then shold make a promise and wait for reponse from ajax call before my page will load, but thats not what happening, the "blink" is still hapening.
Any ideas how to solve this?