How to declare a function inside a component (typescript) and call it on a click event in Angular 2? Following is the code for the same functionality in Angular 1 for which
https://angular.io/guide/user-input - there's a simple example .