You can deal with it using the Directive, as Igor said, as shown below
create directive with
import { Directive, HostListener, Renderer, ElementRef } from '@angular/core'; @Directive({ selector: '[change]' }) export class ChangeDirective{ constructor( private renderer: Renderer, private el: ElementRef ){} @HostListener('keyup') onKeyUp() { console.log('some thing key upped') } }
Import it into main.ts
Add to module ads
Live demo
source share