Are complex expressions possible in ng-hide / ng-show?

前端 未结 5 1054
难免孤独
难免孤独 2020-12-07 16:04

I want to do so:

ng-hide=\"!globals.isAdmin && mapping.is_default\"

but the expression evaluates always to false.

5条回答
  •  心在旅途
    2020-12-07 16:57

    ng-show / ng-hide accepts only boolean values.

    For complex expressions it is good to use controller and scope to avoid complications.

    Below one will work (It is not very complex expression)

    ng-show="User=='admin' || User=='teacher'"
    

    Here element will be shown in UI when any of the two condition return true (OR operation).

    Like this you can use any expressions.

提交回复
热议问题