angularjs NG-NG重复的模式指令内使用$指数 [英] angularjs ng-repeat use $index inside ng-model directive
本文介绍了angularjs NG-NG重复的模式指令内使用$指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用 NG-重复
<ul>
<li ng-repeat = "n in [1,2,3,4]>
<label id="{{'p'+ n }}"> {{n}} </label>
<label ng-model="{{'p'+ n }}"> {{n}} </label>
</li>
</ul>
第一个标签的作品。它的身份证的正确分配。但是,第二个标签不工作。
The first "label" works. Its "id" is assigned properly. But the second "label" doesn't work.
是因为NG-模式无法动态创建?
Is that because "ng-model" cannot be created dynamically?
我试图用&LT;选择NG模型... NG选项...&GT;
A 中的NG-重复
。不能够创造这些NG-模式动态,我在这里卡住了。
I was trying to use <select ng-model ... ng-options ...>
within a ng-repeat
. Not being able to create these "ng-model" dynamically, I am stuck here.
推荐答案
NG-模型
是角属性,你并不需要包括 {{}}
- 尝试 NG-模式='p'+ N
ng-model
is an Angular attribute, you don't need to include the {{}}
-- try ng-model="'p' + n"
这篇关于angularjs NG-NG重复的模式指令内使用$指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文