title: Angular Material - show mat-error on button click
body: <p>I am trying to do validation using the <code>&lt;mat-form-field&gt;</code> and <code>&lt;mat-error&gt;</code>. This works fine when user tabs out of the input without filling. But how do I force this error to show when I click a button? I am not using submit. Also, using template-driven forms.</p>
  <p>This is my code:</p>
  <p>HTML:</p>
  <pre><code>&lt;mat-form-field&gt;
      &lt;input matInput placeholder=&quot;Due Date&quot; name=&quot;dueDate&quot; [(ngModel)]=&quot;dueDate&quot; [formControl]=&quot;dueDateValidator&quot; required&gt;
      &lt;mat-error *ngIf=&quot;dueDateValidator.invalid&quot;&gt;Due Date is required for Tasks&lt;/mat-error&gt;
  &lt;/mat-form-field&gt;
  </code></pre>
  <p>TS:</p>
  <p><code>dueDateValidator: FormControl =  new FormControl('', [Validators.required]); </code></p>