首页 > 其他 > 详细

ng-repeat 嵌套 ng-switch 出错解决

时间:2016-03-05 00:16:57      阅读:171      评论:0      收藏:0      [点我收藏+]

Error: $compile:ctreq

Missing Required Controller
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>
 

ng-repeat 嵌套 ng-switch 出错解决

原文:http://www.cnblogs.com/yuyutianxia/p/5243771.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!