Angularjs - boucle-问题 [英] Angularjs - boucle- problem
本文介绍了Angularjs - boucle-问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何
to repeat a div as the number entered
我要重复的div是:
the div I want to repeat is:
<div class="form-group">
<div class="col-md-6 col-xs-12">
<li>Option {{i}}</li>
<input type="radio" ng-model="score" ng-value=""/>
<br>
<textarea ng-model="option" class="form-control" ></textarea>
</div>
</div>
我尝试过:
i需要帮助plz
What I have tried:
i need Help plz
<div ng-repeat="i in range(Data.nop) track by $index">
$scope.range = function(nop){
var input = [];
nop = parseInt(nop);
for (var i = 0; i < nop; i++) {
input.push(i+1)
}
return input;
}
但ng-model =选项不起作用。
but ng-model=option not work.
推荐答案
index >
scope.range = function(nop){
var input = [];
nop = parseInt(nop);
for(var i = 0; i < nop; i ++) {
< span class =code-attribute>
input.push(i + 1)
}
return 输入;
}
scope.range = function(nop){ var input = []; nop = parseInt(nop); for (var i = 0; i < nop; i++) { input.push(i+1) } return input; }
但ng-model =选项不起作用。
but ng-model=option not work.
这篇关于Angularjs - boucle-问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文