title: How to call function on input text change in angular 2
body: <p>I want to call the type script function on input change of text box, and its working for me. But it call on every change, I want to call when the minimum number of character in the text box are 5.</p>
  
  <pre><code>export class StudentMaintenanceComponent implements OnInit {
      @Component({
          selector: 'app-student-management',
          template: `&lt;input placeholder="" class="form-control" type="text" [maxlength]="5" (input)="SearchData($event.target.value)"&gt;`,
          styleUrls: ['./app-student-management.css']
      })
  
      SearchData(_no: string) { // should be called when minimum no of character are 5 in the text field.
          console.log(_no);
      }
  }
  </code></pre>