For a select element I'm trying to prevent the value from changing based on some conditions:
<select [ngModel]="selectedPriority" (change)="onPriorityChanged($event)">
<option *ngFor="let priority of priorities" [ngValue]="priority">{{priority.label}}</option>
</select>
onPriorityChanged(event) {
event.preventDefault();
return false;
}
This is not working. The model is not updated because I use 1-way binding but the selected item in the select changes, even though I use preventDefault.
What is the correct way to achieve this ?