import { Directive, ElementRef, HostListener } from '@angular/core';

@Directive({
  selector: '[CustomInput]'
})
export class CustomInputDirective {

  constructor(private el: ElementRef) {
  }
 TempValue = 0;
 @HostListener('document:keyup', ['$event'])
 handleKeyboardEvent(event: KeyboardEvent) {
   if(this.el.nativeElement.value.length<=this.el.nativeElement.maxLength){
     this.TempValue = this.el.nativeElement.value;
   }
   this.el.nativeElement.value = this.TempValue;
 }
 
}
