angular/components

MatInput does not clear error state on form reset

Open

#13.240 aperta il 21 set 2018

Vedi su GitHub
 (11 commenti) (3 reazioni) (0 assegnatari)TypeScript (6650 fork)batch import
P3area: material/inputhelp wanted

Metriche repository

Star
 (24.044 star)
Metriche merge PR
 (Merge medio 2g 16h) (80 PR mergiate in 30 g)

Descrizione

This is my submiting function

public submitCategoryForm(): void { this.buttonText = 'Processing...'; this.isClicked = true;

const categoryData = this.categoryForm.value;
this.categoryModel = new CategoryInputModel(
  categoryData['title'],
  categoryData['imageUrl']
);

this.categoryServices.addNewCategory(this.categoryModel).subscribe(() => {
  this.buttonText = 'Add';
  this.isClicked = false;
  this.categoryForm.reset({ title: '', imageUrl: '' });
});

}

What is the use-case or motivation for changing an existing behavior?

After submiting my form (successfully) and reset values of the form, validations for required value pop up. How i can submit my form clear values and to make sure validations are not shown.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 6, Material 6.4.7

Is there anything else we should know?

Guida contributor