Search code examples
javascriptangularjsangulartypescriptangular12

How can i achieve autofill feature while email is already exist in database or API In angular 12


If the email is existed in database, then all the required input field get autofill How I can achieve this feature in angular with using API.


Solution

  • If you are using forms, you can implement that by

    this.formName.formControlName.setValue(valueYouWantToSet);

    for this to work, you will have to get the controls of the form via:

    get f() { return this.formName.controls }

    If you are not using forms and want to implement via ngModel([(ngModel)]="variableName"), then you can try with

    this.variableName = valueYouWantToSet