Controller ‘ngSwitch‘, required by directive ‘ngSwitchWhen‘, can‘t be found!
<div class="item" ng-repeat="item in list">
<!--0表进行中,1表已提车, 2表待结账-->
<div ng-switch="item.state.value">
<div ng-switch-when="0" class="ui top right attached label yellow">服务中</div>
<div ng-switch-when="1" class="ui top right attached label red">已结账</div>
<div ng-switch-when="2" class="ui top right attached label orange">待结账</div>
<div ng-switch-default class="ui top right attached label">已挂账</div>
</div>
</div>
ng-repeat每个循环都会创建一个scope
修改为:
<div class="item" ng-repeat="item in list" ng-switch="item.state.value">
<!--0表进行中,1表已提车, 2表待结账-->
<div ng-switch-when="0" class="ui top right attached label yellow">服务中</div>
<div ng-switch-when="1" class="ui top right attached label red">已结账</div>
<div ng-switch-when="2" class="ui top right attached label orange">待结账</div>
<div ng-switch-default class="ui top right attached label">已挂账</div>
</div>
原文:http://www.cnblogs.com/yuyutianxia/p/5243771.html