Is this possible to add a custom onChange function to the default FormControl? Currently I've seen examples on registering onchange functions on a custom input but non on the default FormControl.
It is possible to bind to the change events for FormControls. For input boxes you need to bind to the input event and for dropdown boxes you need to bind to the change event.
<form [formGroup]="form">
<input formControlName="inputControl"
(input)="inputChange()"
placeholder="Enter a Value"/>
<select formControlName="dropdownControl"
(change)="dropdownChange()">
<option>Beetle</option>
<option>Lady Bug</option>
<option>Grasshopper</option>
<option>Firefly</option>
</select>
</form>
Here is a Plunkr demonstrating how the events work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With