简体   繁体   English

用户登录时隐藏div

[英]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. 我有一个参数来查找当前是否有任何用户登录,即current_user。 If it is 'nil' then no user is logged in or otherwise. 如果为“ nil”,则没有用户登录或以其他方式登录。 so i want to hide the login button when current_user is not equal to 'nil'. 所以我想在current_user不等于'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. 谢谢。

ng-hide 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. 当ngHide表达式的值为真值时,会将.ng-hide CSS类添加到元素上的class属性,使其隐藏。 When falsy, the .ng-hide CSS class is removed from the element causing the element not to appear hidden. 伪造时,将从元素中删除.ng-hide CSS类,以使该元素不会显示为隐藏。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM