You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the authService the { cache: true } expedient is ok for performance but if I logout and then I log in with a new user the link on the nav bar remains with the name of the previous logged user. Refreshing the page solves the issue.
In the mainCtrl (code below) the vm.user obj is only available inside the promise but outside is undefined. Is there a way to make it available to the other functions of the controller?
// get user information on page load
Auth.getUser()
.then(function(data) {
vm.user = data.data;
console.log("inside: ", vm.user); // obj...
});
console.log("outside: ", vm.user); // undefined
});
Bye for now, ciao
The text was updated successfully, but these errors were encountered:
Binding it to vm directly binds it to the controller outside of the scope of the promise as long as you have vm = this; in the beginning of your controller. Is this not the behavior you are seeing?
I have vm = thisat the very beginning but my problem was that being a promise the data was available after a certain amount of time and the other binds were flickering (interpolation problem) till that time. I solved by using the resolve property of the route, so data is already there when the view is open.
Ciao e grazie!!
In the authService the
{ cache: true }
expedient is ok for performance but if I logout and then I log in with a new user the link on the nav bar remains with the name of the previous logged user. Refreshing the page solves the issue.In the mainCtrl (code below) the vm.user obj is only available inside the promise but outside is undefined. Is there a way to make it available to the other functions of the controller?
Bye for now, ciao
The text was updated successfully, but these errors were encountered: