Using HostBinding, HostListener rather than :host

279 views Asked by At

I'm building a service and I need to remove the host property. I know this isn't going to break my application, but how would I go about doing this.

I currently have

    @Directive({
    selector: '[phoneMask]',
      host: {
        '(ngModelChange)': 'onInputChange($event)',
        '(keydown.backspace)': 'onInputChange($event.target.value, true)'
      }
    })

I need to use HostBinding and HostListener.

    @Directive({
    selector: '[phoneMask]',
       @HostBinding('attr.ngModelChange');
       @HostListener(keydown.backspace): onInputChange($event.target.value, true )
    })

Could someone point me in the right direction to fix this code?

0

There are 0 answers