【发布时间】:2016-09-19 13:40:47
【问题描述】:
我想将元素的数量更改为选择框给出的数量。
我的代码:
index.php
<select class="form-control-static" ng-model="fieldSelect" ng-change="showSelectValue(fieldSelect)">
<option ng-repeat="i in getNumber(number) track by $index" value="{{$index+1}}">{{$index+1}}</option>
</select>
index.php
<div ng-repeat="t in getTimes(1) track by $index")>
Hello!
</div>
default.js
$scope.showSelectValue = function(fieldSelect) {
contentFields = fieldSelect;
$scope.getTimes();
};
$scope.getTimes=function(n){
n = contentFields;
return new Array(n);
};
【问题讨论】:
标签: javascript jquery angularjs angularjs-scope ng-repeat