0
我想將元素的數量更改爲選擇框給出的數字。 我的代碼:
基於選擇的ngRepeat
的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);
};
謝謝!這對我有用! – CrazzyMarc