我想在我的角度组件的选择标签中更改所选选项时获取值:
<select name="types" class="custom-select form-control rounded" (change)="changeType($event.target.value)">
<option selected value="allTypes">Tous</option>
<option *ngFor="let type of types; let i = index" [value]="types.id">
{{types[i].name}
</option>
</select>
changeType(type) {
this.chosenType = type
console.log('changed type', type)
this.getData()
}
当日志选择类型时,我不确定!
使用ngValue解决问题