Conditional ng-include in angularjs

前端 未结 5 2270
囚心锁ツ
囚心锁ツ 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:24

    If you are using Angular v1.1.5 or later, you can also use ng-if:


    If you have any older version:

    Use ng-switch:

    Fiddle

提交回复
热议问题