Skip to content

Instantly share code, notes, and snippets.

@Flayed
Created March 29, 2018 16:33
Show Gist options
  • Save Flayed/ed3bc5bfb65af9770801902ff2542a51 to your computer and use it in GitHub Desktop.
Save Flayed/ed3bc5bfb65af9770801902ff2542a51 to your computer and use it in GitHub Desktop.
ngModelChange
<select [(ngModel)]="myValue" (ngModelChange)="toNumber()">
<option *ngFor="let s of stuff" [value]="s.value">{{s.key}}</option>
</select>
public toNumber() {
this.myValue = +this.myValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment