AllowSpecialAlphabetsDirectives
This will block the allow special characters in the input box. use this directive to allow all the specials in this functionalities
Save this directive and name it as alloy special
@HostListener('keyup', ['$event']) onKeyUp(event) {
let value = this. eleRef.nativeElement.value;
value = this. functionCall(value);
this. eleRef.nativeElement.value = value;
}
@HostListener('paste', ['$event']) onPaste(event) {
this. eleRef.nativeElement.value =
this.functionCall(_.replace(this. eleRef.nativeElement.value, /[^a-zA-Z0-9 ]/g, ''));
}
functionCall(value) {
value = _.replace(value, /^\s/g, '');
value = _.replace(value, /\d/g, '');
return value;
}
0 Comments