What is the equivalent for jQuery change event on every input in Angular2? Example:
$("input").on('change', function() { console.log("*"); }); You can handle it using Directive as said by Igor as below
create a directive using
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 to the main.ts
Add to declarations of the module
inputand register thechangeevent.