How do you cancel a dropdown change event in Angular 2?
HTML:
<select [(ngModel)]="statusId" (change)="onStatusChange($event)">
<option *ngFor="let status of statuses" [ngValue]="status.id">{{status.text}}</option>
</select>
TS:
onStatusChange(e: Event) {
var oldStatusId = this.statusId;
var newStatusId = e.target.value;
if(this.submitNewValue(newStatusId)){
console.log('value changed');
} else {
console.log('value not changed');
// How to cancel this and keep the previously selected value in the dropdown?
}
}