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>
 

AngularJS ng-repeat下使用ng-model

<table>
<tr ng-repeat="row in collections">
<td>
{{row.name}}: <input type="radio" value="{{row.value}}" ng-model="selectValue"/>
</td>
</tr>
</table>

当你书写了上述代码后。你会发现点击其中的对话框,$scope.selectValue中并没有保存你选中的对应单选框的值。

这是因为处在ng-repeat之间的代码,对全局的$scope里变量的内容是不可见的,而是为ng-repeat创建的子scope里面的。

所以要引用ng-repeat $scope里的成员,你可以使用$parent

 
<table>
<tr ng-repeat="row in collections">
<td>
{{row.name}}: <input type="radio" value="{{row.value}}" ng-model="$parent.selectValue"/>
</td>
</tr>
</table>
 

ng-repeat 嵌套 ng-switch 出错解决的更多相关文章

  1. (转)ViewPager,ScrollView 嵌套ViewPager滑动冲突解决

    ViewPager,ScrollView 嵌套ViewPager滑动冲突解决 本篇主要讲解一下几个问题 粗略地介绍一下View的事件分发机制 解决事件滑动冲突的思路及方法 ScrollView 里面嵌 ...

  2. make menuconfig出错解决方法

     make menuconfig出错解决方法 2011-06-11 22:22:49 分类: 系统运维 错误现象: make menuconfig In file included from scri ...

  3. vs连接mysql出错解决方法

    vs连接mysql出错解决方法 先按以下的步骤配置一下: **- (1)打开VC6.0 工具栏Tools菜单下的Options选项.在Directories的标签页中右边的"Show dir ...

  4. paip.vs2010 或.net 4.0安装出错解决大法.

    paip.vs2010 或.net 4.0安装出错解决大法. 作者Attilax ,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:http://blog.cs ...

  5. 黄聪:C#使用Application.Restart重启程序出错解决办法

    调用 Application.Restart重启程序出错 解决办法,就是给程序的.exe文件,加上下面的设置

  6. $ sudo python -m pip install pylint 出错解决方法

    问题:在unbuntu执行$ sudo python -m pip install pylint出错解决方法支行以下命令sudo pip install pylint==1.9.3这样roboware ...

  7. npm中npm install 始终出错解决办法

    npm中npm install 始终出错解决办法 错误信息: C:\Windows\System32>npm install -g gulp npm ERR! Windows_NT 6.1.76 ...

  8. $ gulp watch 运行出错解决方法

    $ gulp watch 运行出错解决方法   $ gulp watch     如果你出现了如下报错信息: gulp-notify: [Laravel Elixir] Browserify Fail ...

  9. 安装openstack同步数据库时出错解决方法

    错误提示:(2003, "Can't connect to MySQL server on 'controller' ([Errno -2] Name or service not know ...

  10. ARM64平台编译stream、netperf出错解决办法 解决办法:指定编译平台为alpha [root@localhost netperf-2.6.0]# ./configure –build=alpha

    ARM64平台编译stream.netperf出错解决办法 http://ilinuxkernel.com/?p=1738 stream编译出错信息: [root@localhost stream]# ...

随机推荐

  1. 【原】iOS多线程之异步任务+并行队列情况与异步任务+串行队列(主队列)情况

    异步任务+并行队列 把异步任务放到并行队列进行执行,异步任务会在不同的线程中执行. /*异步执行+并行队列*/ - (IBAction)clickBasic1:(UIButton *)sender { ...

  2. iOS学习09C语言函数指针

    本次主要学习和理解函数指针 1.函数指针 void printValue(int number) { printf("number = %d\n", number); } int ...

  3. ROW_NUMBER() OVER函数的基本用法

    转自:http://www.cnblogs.com/icebutterfly/archive/2009/08/05/1539657.html 语法:ROW_NUMBER() OVER(PARTITIO ...

  4. [译]使用Continuous painting mode来分析页面的绘制状态

    Chrome Canary(Chrome “金丝雀版本”)目前已经支持Continuous painting mode,用于分析页面性能.这篇文章将会介绍怎么才能页面在绘制过程中找到问题和怎么利用这个 ...

  5. input type=checkbox checked disabled

    input type=checkbox checked disabled 禁用无法提交!

  6. HDU - Pseudoforest

    Description In graph theory, a pseudoforest is an undirected graph in which every connected componen ...

  7. wxPython学习

    http://www.cnblogs.com/coderzh/archive/2008/11/23/1339310.html 一个简单的实例: #!/usr/bin/python import wx ...

  8. Java_JDK动态代理学习笔记

    昨天被问了个问题,问题的大意是这样的:为什么 Proxy.newProxyInstance(ClassLoader loader, Class<?>[] interfaces, Invoc ...

  9. Mockito学习资料

    官网:http://mockito.org/ https://dzone.com/refcardz/mockito

  10. Bootstrap整合ASP.NET MVC验证、jquery.validate.unobtrusive

    没什么好讲的,上代码: (function ($) { var defaultOptions = { validClass: 'has-success', errorClass: 'has-error ...