Header Ads

remove whitespace Directives



remove whitespace Directives

These directives don't allow the white spaces into the input field when the user adds it.


Add the directives name inside the input field

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


Save these directives and name it as remove spaces

  
   @HostListener('keyup'['$event']) onKeyUp(event) {
        let value = this. eleRef.nativeElement.value;
        value = this. functionCall(value);
       
        this. eleRef.nativeElement.value = value;
    }

    functionCall(value) {
       value = _.replace(value/^\s/g'');
      
       return value;
    }

Post a Comment

1 Comments