是否可以使用角度范围进行for循环?例如。我有:
$scope.start = 1;
$scope.end = 10;
并希望制作一个(例如我知道它不起作用)
for($scope.start; $scope.start < $scope.end; $scope.start++) {
print(<input type="radio" name="count" value="$scope.start">);
}
答案 0 :(得分:0)
<script src="//code.angularjs.org/snapshot/angular.min.js"></script>
<div ng-app='app' ng-controller="MyController">
start: <input type="text" ng-model='start'>
</br>
stop: <input type="text" ng-model='stop'>
</br>
interval: <input type="text" ng-model='interval'>
</br>
<label ng-repeat-start='item in getTimeArray(start, stop, interval)'>{{item}}</label>
<input type="radio" name="count" value="{{item}}" ng-repeat-end>
</div>
(...)
onOptionsChange(newState){
this.setState(newState);
}
render(){
return (
<Options onOptionsChange={(newState) =>
this.onOptionsChange(newState)} />
)
}
}
(...)