Dreamer
Dreamer

Reputation: 73

Hide a div when user is logged in

I have a parameter to find out whether there is any user currently logged in or not, namely current_user. If it is 'nil' then no user is logged in or otherwise. so i want to hide the login button when current_user is not equal to 'nil'. any suggestions?

<div ng-click="login_popup()">
        	
        	<a style="color: #fff;padding: 5px 10px;font-weight: 600;background: #00bfa9;text-transform: uppercase;margin: 10px;font-size: 15px;cursor: pointer;display: block;float: right;">
              Login
            </a>
        	</div>

Thanks.

Upvotes: 0

Views: 296

Answers (1)

nicfo
nicfo

Reputation: 450

ng-hide

When the ngHide expression evaluates to a truthy value then the .ng-hide CSS class is added to the class attribute on the element causing it to become hidden. When falsy, the .ng-hide CSS class is removed from the element causing the element not to appear hidden.

<button ng-hide="current_user">login</button>

Upvotes: 2

Related Questions