AngularJS directive only when the condition is true

前端 未结 3 1611
無奈伤痛
無奈伤痛 2021-01-06 21:50

I am going to have a contextmenu directive in ng-repeat items. Based on whether a condition is true, the directive should be applied. How do I put a condition like only when

3条回答
  •  耶瑟儿~
    2021-01-06 22:22

    Can you do something like this, using ng-if?

    • {{item.name}}

    Here are the docs for ng-if.

    EDIT: If you are driving the context menu off of a class, you should be able to do this:

    • {{item.name}}

提交回复
热议问题