Conditional ng-include in angularjs

前端 未结 5 2239
囚心锁ツ
囚心锁ツ 2020-12-04 10:48

How can I do the ng-include conditionally in angularJS?

For example I only want to include something if, the variable x is set to true.

5条回答
  •  無奈伤痛
    2020-12-04 11:31

    If the condition is simple enough, you could also put the conditional logic directly in the ng-include expression:

    Note the expression x is not in single quotes and therefore evaluated. See http://plnkr.co/edit/4fvNDa6Gm3dbVLgsAZrA for more details.

提交回复
热议问题