ng-repeat 嵌套 ng-switch 出错解决
Error: $compile:ctreq
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 出错解决的更多相关文章
- (转)ViewPager,ScrollView 嵌套ViewPager滑动冲突解决
ViewPager,ScrollView 嵌套ViewPager滑动冲突解决 本篇主要讲解一下几个问题 粗略地介绍一下View的事件分发机制 解决事件滑动冲突的思路及方法 ScrollView 里面嵌 ...
- make menuconfig出错解决方法
make menuconfig出错解决方法 2011-06-11 22:22:49 分类: 系统运维 错误现象: make menuconfig In file included from scri ...
- vs连接mysql出错解决方法
vs连接mysql出错解决方法 先按以下的步骤配置一下: **- (1)打开VC6.0 工具栏Tools菜单下的Options选项.在Directories的标签页中右边的"Show dir ...
- paip.vs2010 或.net 4.0安装出错解决大法.
paip.vs2010 或.net 4.0安装出错解决大法. 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.cs ...
- 黄聪:C#使用Application.Restart重启程序出错解决办法
调用 Application.Restart重启程序出错 解决办法,就是给程序的.exe文件,加上下面的设置
- $ sudo python -m pip install pylint 出错解决方法
问题:在unbuntu执行$ sudo python -m pip install pylint出错解决方法支行以下命令sudo pip install pylint==1.9.3这样roboware ...
- npm中npm install 始终出错解决办法
npm中npm install 始终出错解决办法 错误信息: C:\Windows\System32>npm install -g gulp npm ERR! Windows_NT 6.1.76 ...
- $ gulp watch 运行出错解决方法
$ gulp watch 运行出错解决方法 $ gulp watch 如果你出现了如下报错信息: gulp-notify: [Laravel Elixir] Browserify Fail ...
- 安装openstack同步数据库时出错解决方法
错误提示:(2003, "Can't connect to MySQL server on 'controller' ([Errno -2] Name or service not know ...
- 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]# ...
随机推荐
- oracle去重
oracle去重 create table tmp_table3 as (SELECT seqno FROM (SELECT t.seqno,ROWID, ROW_NUMBER() OVER(PART ...
- Codeforces Round #209 (Div. 2) B. Permutation
解题思路: 如果序列a是单调递增的,则序列为1,2,..... 2n,则将给出的式子化简得Σ(a2i - a2i-1) = n 如果序列a是单调递减的,则序列为2n,.........2, 1,则将给 ...
- 【BZOJ】2729: [HNOI2012]排队
题意 \(n\)个男生\(m\)个女生\(2\)个老师排列,任意两个女生不能相邻,两个老师也不能相邻,每个人都不同.问有多少种排法.(\(n, m \le 2000\)) 分析 组合乱搞. 题解 先放 ...
- 【BZOJ1951】【SDOI2010】古代猪文 Lucas定理、中国剩余定理、exgcd、费马小定理
Description “在那山的那边海的那边有一群小肥猪.他们活泼又聪明,他们调皮又灵敏.他们自由自在生活在那绿色的大草坪,他们善良勇敢相互都关心……” ——选自猪王国民歌 很久很久以前,在山的那边 ...
- 纪念逝去的岁月——C/C++排序二叉树
1.代码 2.运行结果 3.分析 1.代码 #include <stdio.h> #include <stdlib.h> typedef struct _Node { int ...
- C#反射生成简单sql语句
static void Main(string[] args) { book book = new book();//实体类 booktest b1 = new booktest(); book.bo ...
- Node.js 手册查询-3-Mongoose 方法
Mongoose 参考手册 标签(空格分隔): MongoDB Mongoose 是什么? 一般我们不直接用MongoDB的函数来操作MongoDB数据库 Mongose就是一套操作MongoDB数据 ...
- JSON value
JSON values can be: A number (integer or floating point) A string (in double quotes) A Boolean (true ...
- mysql相似于oracle的to_char() to_date()方法
mysql日期和字符相互转换方法, date_format(date,'%Y-%m-%d') -------------->oracle中的to_char(); str_to_date(dat ...
- [转]B树、B-树、B+树、B*树
题记:转一篇很直观介绍各类B树的文章. B树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right): 2.所有结点存储一个关键字: 3.非叶子结点的左指针指向小于其关键字的子树, ...