1<select [ngModel]="selectedItem" (ngModelChange)="onChange($event)">
2onChange(newValue) {
3 console.log(newValue);
4 this.selectedItem = newValue; // don't forget to update the model here
5 // ... do other stuff here ...
6}
1<select (change)="onChange($event.target.value)">
2 <option *ngFor="let i of devices">{{i}}</option>
3</select>
4
5onChange(deviceValue) {
6 console.log(deviceValue);
7}
8
1<select (change)="onChange($event.target.value)">
2 <option *ngFor="let i of devices">{{i}}</option>
3</select>
4
5onChange(deviceValue) {
6 console.log(deviceValue);
7}
1-------------For Two Way Data Binding-----------------
2<select [ngModel]="selectedDevice" (ngModelChange)="onChange($event)" name="deviceText">
3 <option [value]="i" *ngFor="let i of devices">{{i}}</option>
4</select>
5
6onChange(event){
7selectedDevice=event;
8 -----
9 -----
10}