Parse User Validation Not Working


#1

I have 2 DIV elements to be shown based on whether the user has logged in or not. I am using ng-hide and ng-show for the same.

<div id="forGuestUsers" ng-hide="isUserLoggedIn()">
</div>

<div id="forLoginUsers" ng-show="isUserLoggedIn()">
</div>

In my controller I have the below code to check if the user is logged in or not.I am using Parse for my backend data.

$scope.isUserLoggedIn = function() {
    return Parse.User.current() !== null;
}

But this does not seem to work. The DIV related to guest is always shown even if the user has logged in.

What I should be doing to make this work? I am new to Ionic and I am in learning phase. Any solution on this would be of great help to me.


#2

I have tried directly to use the condition in ng-show/ng-hide. But still no luck.

<div id="forLoginUsers" ng-show=" Parse.User.current() !== null">
</div>

#3

Try “!===” because NULL - typeof have to be


#4

!=== is not a valid syntax as per my limited knowledge on JavaScript.


#5

If this not working try

<div id="forLoginUsers" ng-show=" Parse.User.current() !== 'null' ">

#6

I solve this by a different method. Thanks for your time.


#7

how did you solve this?


#8

I will get you the exact code when I get home.