Question: I want to check whether the input is empty.

* If not empty, enable the submit button.
* If empty, disable the submit
button.

I tried `(oninput)` and `(onchange)`, but they do not run.

```
<input type="password" [(ngModel)]="myPassword" (oninput)="checkPasswordEmpty()"/>

checkPasswordEmpty() {
    console.log("checkPasswordEmpty runs");
    if (this.myPassword) {
        // enable the button
    }
}

```

Answer: 
In this case, I would leverage form validators. I would add the "required" validation on your input and use the global state of your form to disable / enable your button.

With the template-driven approach, there is no code to add in your component, only stuff in its template...

Here is sample below:

```
<form #formCtrl="ngForm">
  <input ngControl="passwordCtrl" required>
  <button [disabled]="!formCtrl.form.valid">Some button</button>
</form>

```
When using the template-driven approach suggested by @Thierry Templier, the form object also has an `invalid` property.

So instead of: 

```
<button [disabled]="!formCtrl.form.valid">Some button</button>

```

You can also use:

```
<button [disabled]="formCtrl.form.invalid">Some button</button>

```

It's a small difference, but overall cleaner syntax in my opinion.