使用ng-switch的Angular Nested条件

时间:2015-06-15 08:04:28

标签: angularjs

在使用ng-switch评估一系列第二层条件之前,是否可以使用ng-show,ng-if或ng-switch评估根第一个条件

<div ng-if="firstcondition = 'true'" >
   <div ng-switch="secondCondition">
      <div ng-switch-when="0">
         <div ng-include="'firstview.html'"></div>
      </div>
      <div ng-switch-when="2">
         <div ng-include="'secondView.html'"></div>
      </div>
      <div ng-switch-when="3">
         <div ng-include="'thirdView.html'"></div>
      </div>
   </div>
</div>

1 个答案:

答案 0 :(得分:1)

您的错误点在这里

<div ng-if="firstcondition = 'true'" >

这应该是这个

<div ng-if="firstcondition == 'true'" >

您使用的是用于分配的单个=符号。