I want to know how to only allow alphabet in an input, if a number or special character is entered in the input, ignore it, i work with Angular.
I work with reactive form but if I use pattern this just validates the field when submit is done, what I need is that for example if I press the number "1" in keyboard it simply does not show, when the key is pressed ignore everything that is not alphabet letter
You can use input mask libraries like this https://www.npmjs.com/package/ngx-mask. Or You can do it yourself like this
this.form.controls["Your Control Name Here"].valueChanges.subscribe((value: string) => {
this.form.controls["Your Control Name Here"].setValue(value.replace(/[^A-Za-z]/, ""), { emitEvent: false });
});