Update
Separate event and property bindings:
<select [ngModel]="selectedItem" (ngModelChange)="onChange($event)">
onChange(newValue) { console.log(newValue); this.selectedItem = newValue;
You can also use
<select [(ngModel)]="selectedItem" (ngModelChange)="onChange($event)">
and then you will not need to update the model in the event handler, but I believe that this leads to two events, so this is probably less efficient.
Old answer before they fixed the bug in beta.1:
Create a local template variable and attach an event (change) :
<select [(ngModel)]="selectedItem" #item (change)="onChange(item.value)">
plunker
See also How to get a new selection in "select" in Angular 2?
Mark Rajcok Dec 21 '15 at 22:31 2015-12-21 22:31
source share