Disable button when input is empty in Angular 2 : <p>I want to check whether the input is empty.</p>

<ul>
<li>If not empty, enable the submit button.</li>
<li>If empty, disable the submit
button.</li>
</ul>

<p>I tried <code>(oninput)</code> and <code>(onchange)</code>, but they do not run.</p>

<pre><code>&lt;input type="password" [(ngModel)]="myPassword" (oninput)="checkPasswordEmpty()"/&gt;

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