I have simple form, and componen for it. When I type something into input field I want to run method inside ts file. But it tells me that it's not defined:

```
Uncaught ReferenceError: printTask is not defined
    at HTMLInputElement.onchange ((index):13)
onchange @ (index):13

```

add-task.component.html:

```
<h5 class="card-title">Add new task</h5>
<form >
  <div class="form-group">
    <label for="taskName"></label>
    <input class="form-control" type="text" name="taskName" id="taskName" placeholder="Enter task name"
           [(ngModel)]="task.id" onchange="printTask()">
  </div>
  <div class="form-group">
    <label for="dueDate"></label>
    <input class="form-control" type="date" name="dueDate" id="dueDate" placeholder="Enter task name"
           [(ngModel)]="task.dueDate" onchange="printTask()">
  </div>
</form>

```

add-task.component.ts

```
import {Component, OnInit} from '@angular/core';
import {Task} from "../../models/task";

@Component({
  selector: 'app-add-task',
  templateUrl: './add-task.component.html',
  styleUrls: ['./add-task.component.css']
})
export class AddTaskComponent implements OnInit {

  task: Task = {
    id: undefined,
    name: '',
    dueDate: '',
    completed: false

  };

  constructor() {
  }

  ngOnInit() {
  }

  printTask() {
    console.log('test');
  }
}

```