-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User is logged in? #46
Comments
It seems like validateUser() should broadcast the event auth:validation-error if no user is signed in? If yes, it doesn't (at least for me) :) |
If the credentials pass verification, a Examples:From javascript (controllers, directives, etc): if ($rootScope.user.signedIn) {
alert("Hello " + $rootScope.user.name + "!");
} Or from templates: <div ng-show='user.signedIn'>
Hello {{ user.name }}!
</div> Note that the templates must have access to the And you're right about the event not broadcasting in some cases. That is a bug - I'll push a fix ASAP. |
Hi there, thanks for the quick response. Unfortunately, the user object is always empty {} ... no matter if I'm logged in or not... |
Can you post the code that you're using to check the |
.run(function($rootScope){
console.log($rootScope.user);
})
|
It won't be available immediately at the start of the run phase because the data must first be retrieved from the API. Try something like this: .run(function($rootScope, $auth) {
$auth.validateUser().then(function() {
console.log($rootScope.user);
});
}); |
You are right ... thanks!!! |
=) |
Hi there,
first of all thanks for your great work!
I have a question, whats the best way to check wether a user is logged in or not? Seems like the validateUser method doesn't work ...
Thanks,
Andi
The text was updated successfully, but these errors were encountered: