在角度1中,我可以使用以下选项为下拉框选择默认选项:
原文链接:https://www.f2er.com/angularjs/144966.html<select data-ng-model="carSelection" data-ng-options = "x.make for x in cars" data-ng-selected="$first"> </select>
在角度2我有:
<select class="form-control" [(ngModel)]="selectedWorkout" (ngModelChange)="updateWorkout($event)"> <option *ngFor="#workout of workouts">{{workout.name}}</option> </select>
如果我选择的数据是:
[{name:’arm’},{name:’back’},{name:’leg’}],我的默认值为