简体   繁体   中英

AngularJS ng-show IF AND condition

<li ng-show="auth==true and user[0].auth==1">

What would be the proper way of writing the above? Both auth and user[0].auth are part of the $rootScope . I just want this list item to show when both $rootScope.auth = true and $rootScope.user[0].auth = 1

你可以像下面这样写

<li ng-show="auth && user[0].auth==1">
<li ng-show="auth==true && user[0].auth==1">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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