我有4個複選框,它們應該像複選框一樣工作,但它們不會。 我只能選擇一個。有人可以幫我解決我的問題嗎?複選框的行爲與Radiobutton類似
我的第二個問題是,它們是否可能從頭被選中?
謝謝!
我想我描述了我的問題錯了,我可以點擊例如兩個複選框,但沒有顯示任何內容。
例如:如果我點擊綠色和紅色,則應顯示兩種顏色。
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div class="form-group">
<input type="checkbox" id="stat1" ng-true-value="'black'" ng-model="statusblack"/>
<label for="stat1">black</label><br />
<input type="checkbox" id="stat2" ng-true-value="'red'" ng-model="statusred"/>
<label for="stat2">red</label><br />
<input type="checkbox" id="stat3" ng-true-value="'yellow'" ng-model="statusyellow"/>
<label for="stat3">yellowt</label><br />
<input type="checkbox" id="stat4" ng-true-value="'green'" ng-model="statusgreen"/>
<label for="stat4">green</label><br />
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Number</th>
<th>Color</th>
<th>Info</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="co in $ctrl.colors | filter:statusred | filter:statusblack | filter:statusgreen | filter:statusyellow">
<td>{{ co.no }}</td>
<td>{{ co.color }}</td>
<td>{{ co.info }}</td>
</tr>
</tbody>
</table>
我能選擇任意複選框。對於第二個問題,如果你想設置他們選擇添加**選中**每個複選框的屬性,如'' –