I need to trim the field value and set the value in onchange event angular
<form [formGroup]="form" (ngSubmit)="submitForm()">
<div>
<input type="text" matInput formControlName="name" [(ngModel)]="name" (ngModelChange)="mychange($event)">
</div>
</form>
private mychange(event) {
console.log(event)
let name: any
let c = event.trim();
console.log(c);
}
Please let me know anybody have idea
You can use value changes event to detect changes, and you can subscribe to that to detect changes.
.html code
.ts code