I would like to get the selected value of a select option in Angular 7. Two-way data binding using ngModel and I also imported FormsModule in app.module.ts.
My HTML file:
<select (change)="selectChangeHandler($event)"
[(ngModel)]="optSelected">
<option *ngFor="let opt of options" [value]="opt.id">
{{opt.title}}
</option>
</select>
My TS file:
optSelected = 'aaa';
selectChangeHandler(event: any) {
this.optSelected = event.target.value;
console.log('The selected option is: ' + this.optSelected);
}