我有一个参数可以判断当前是否有用户登录,即current_user。如果它是“nil”,则没有用户登录或以其他方式登录。所以我想在 current_user 不等于'nil'时隐藏登录按钮。有什么建议吗?
<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>
谢谢。
最佳答案
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>
关于javascript - 用户登录时隐藏一个div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34636430/