Turn Off Angular Material Input Autocomplete | Task

Ole Ersoy
Feb - 04  -  1 min

Scenario

We wish to turn off autocomplete for our Angular Material input field.

Approach

Set autocomplete to off <input matInput type="text" autocomplete="off"/>:

<mat-form-field class="example-form-field">
  <mat-label>Clearable input</mat-label>
  <input matInput type="text" [(ngModel)]="value" autocomplete="off" />
  <button
    mat-button
    *ngIf="value"
    matSuffix
    mat-icon-button
    aria-label="Clear"
    (click)="value=''"
  >
    <mat-icon>close</mat-icon>
  </button>
</mat-form-field>

Demo