我想擺脫一堆使用ng-repeat的重複div。AngularJS ng-repeat設置屬性
<!-- I have 21 of these -->
<div class="table-row">
<span class="glyphicon glyphicon-wrench"></span>
<label>Chloride</label>
<input type="range" min="700" max="1200" ng-model="chlorideSlider"/>
<input type="text" class="val" ng-model="chloride"/>
</div>
<!-- I'd like to use ng-repeat to create them -->
<div class="table-row" ng-repeat="item in sliderItems.items">
<span class="glyphicon glyphicon-pencil"></span>
<label>{{ item.label }}</label>
<input type="range" min="item.min" max="item.max" ng-model="item.slider"/>
<input type="text" class="val" ng-model="item.model"/>
</div>
這是數據:
$scope.sliderItems = { 'items' : [
{'label' : 'WBC', 'min' : 0, 'max' : 600, 'slider' : $scope.wbc, 'model' : $scope.wbc, 'tr' : 'wbc_tr' },
{'label' : 'Respiration', 'min' : 0, 'max' : 60, 'slider' : $scope.resp, 'model' : $scope.resp, 'tr' : 'wbc_tr' }
]};
最小值和最大值不會在所有的工作。模型顯示正確的值,直到它們改變並且我嘗試更改只讀值錯誤。
你想做些什麼?它不清楚.. :( –
我想做的事情就像在第二個div。但是,這是不正常工作,如上所述,謝謝。 –