How to call onchange event on the dropdown in angular?

In angular you can also use onchange event its easy to do. You can follow this code to do it.

<select formControlName="tableName" (change)='onSelectChange($event)'>
 <option value="">Select</option>
 <option value="India">India</option> 
</select>

onSelectChange(event) {
  const value = event.target.value;
  console.log(value);
}

For more info or more way to do it you can follow this URL.

https://stackoverflow.com/questions/49715251/how-to-add-onchange-event-on-dropdown-in-angular/65194016#65194016

Leave a Comment