如果我在 ng-switch 中放置了一个选择标签,那么两种方式的绑定对于 ng-switch 之外的选择标签 ng-model 不起作用。
请参考以下代码
<div ng-switch on="OutputStep">
<div ng-switch-when="0">
Switch Step One
</div>
<div ng-switch-when="1">
Switch Step Two<br/>
<select ng-model="SelectedReviewOption" ng-options="review as review.DisplayValue for review in ReviewOptions">
</select>
Selected Value : {{SelectedReviewOption.DisplayValue}}
</div>
</div>
<button ng-click="OutputStep = '0'" ng-disabled="OutputStep == '0'">
Back
</button>
<button ng-click="OutputStep = '1'" ng-disabled="OutputStep == '1'">
Next
</button>
Selected Value Outside Switch : {{SelectedReviewOption.DisplayValue}}
在这个小提琴中,单击下一步按钮查看第二个切换页面。更改选择标签中的值。观察改变的值不能显示在开关之外——