guys. I'm doing a login page. When users haven't logged in, the page will show greetings and login button. When users logged in, the greeting and login button will disappear and logout button will appear.
However, my greeting div just NEVER disappears. I don't know why. I tried to use $scope.$apply() but it didn't work at all. The followings are my code. Please help, thanks.
PS: I want the greetings to disappear when people login, and also greetings will appear when people logout.
My HTML
<div ng-show="show.intro">
<h3>Hi, how are you?</h3>
<i>*Please log in first to access your news.</i>
</div>
<span>
<br>
<button type="button" class="btn btn-info" ng-click="login()" ng-hide="authData">Login using Google Account</button>
</span>
<span class="pull-right">
<br>
<button type="button" class="btn btn-info" ng-click="logout()" ng-show="authData">Log Out</button>
</span>
My Controller
.controller("AuthController", ["$scope", "$location",
function($scope, $location) {
$scope.show = {intro: true};
$scope.login = function() {
$scope.show.intro = false;
};
$scope.logout = function() {
$scope.show.intro = true;
};
Thanks.