<label class="radio-inline">
<input name="display" type="radio" value="true" ng-model="institution.display" checked required>显示
</label>
<label class="radio-inline">
<input name="display" type="radio" value="false" ng-model="institution.display">隐藏</label>
angularjs如何默认选中第一个
checked = "checked"
使用 ng-checked
即可。
<label class="radio-inline">
<input name="display" type="radio" value="true" ng-model="institution.display" ng-checked="true" required>
显示
</label>
<label class="radio-inline">
<input name="display" type="radio" value="false" ng-model="institution.display">
隐藏
</label>
可在 ng-repeat
中使用 ng-checked
, 形如:
<label ng-repeat="(key, val) in genders track by $index">
<input type="radio" name="gender" value="{{key}}" ng-checked="list.gender==key">{{val}}
</label>
双向绑定
双向绑定
双向绑定
重要的说三遍~~~
$scope.institution.display = "true";
即ng-model和value相同即可。
ng-checked
同时加上ng-model绑定元素就可以了
institution.display 的值设成对应的