Header Ads

AllowSpecialAlphabets Directives

AllowSpecialAlphabetsDirectives


This will block the allow special characters in the input box. use this directive to allow all the specials in this functionalities

Add the directives name inside the input field

<input type = "text" name="name" allowSpecial >


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;
    }

Post a Comment

0 Comments