<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>
How to select the first one by default in angularjs
为情所困2017-05-15 16:57:10
Just use 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>
某草草2017-05-15 16:57:10
Two-way binding
Two-way binding
Two-way binding
It’s important to say it three times~~~
$scope.institution.display = "true";
That is, ng-model and value can be the same.
淡淡烟草味2017-05-15 16:57:10
can be found in ng-repeat
中使用 ng-checked
, in the form:
<label ng-repeat="(key, val) in genders track by $index">
<input type="radio" name="gender" value="{{key}}" ng-checked="list.gender==key">{{val}}
</label>