我正在使用Angular 2(TypeScript).
我想为新的选择做点什么,但是我在onChange()中得到的东西总是最后选择.我怎样才能获得新的选择?
<select [(ngModel)]="selectedDevice" (change)="onChange($event)">
<option *ngFor="#i of devices">{{i}}</option>
</select>
onChange($event) {
console.log(this.selectedDevice);
// I want to do something here for new selectedDevice, but what I
// got here is always last selection, not the one I just select.
}
Run Code Online (Sandbox Code Playgroud)