我正在尝试为角度6中的选择选项设置默认选定对象。但它不起作用
<select name="editUserType" class="form-select" id="editUserType" [(ngModel)]="updateModel.userType">
<option value="" selected disabled>Select User Type</option>
<option *ngFor="let userType of userTypeList" [selected ]="userType.code == updateModel.userType.code" [ngValue]="userType">{{userType.description}}</option>
</select>
userType是我想要的对象,当我加载网页时为select选项设置默认对象。
设置组件的默认值
constructor(){
this.updateModel.userType = ""
}