我有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>
我能选择任意复选框。对于第二个问题,如果你想设置他们选择添加**选中**每个复选框的属性,如'' –