0

I have been trying to use browser's form-data option in my Angular App but not working properly.

It stores only first user input but browser is not remembering the second input onward...,

Here is my stackblitz of my code.

<form [formGroup]="myForm">
    <mat-form-field hintLabel="Max 50 characters" appearance="fill">
        <mat-label>Name</mat-label>
    
        <input matInput #input2 formControlName="myName" id="myName" name="myName" maxlength="50" autocomplete="on">

        <mat-hint align="end">{{input2.value?.length || 0}}/50</mat-hint>
    </mat-form-field>
</form>

What I tried?

id="myName" name="myName" autocomplete="on"

What else should I use?

Ramesh
  • 1,041
  • 15
  • 39

1 Answers1

0

instead of just 'on' you can specify the value of the autocomplete:

autocomplete="name"

The following prompted me with an autocomplete of my full name: https://stackblitz.com/edit/angular-mat-input-nboebn?file=src%2Fapp%2Fapp.component.html

For a full list of the values you can provide see: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

robbieAreBest
  • 1,601
  • 14
  • 16