MatInput does not clear error state on form reset
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
**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?
Contributor guide
Research direction
Reproduce the behavior from the submitCategoryForm entry point, especially the categoryForm.reset({ title: '', imageUrl: '' }) call, using the reported Angular 6 and Material 6.4.7 versions if available. Determine whether reset should leave required-field errors hidden, then add or update the relevant form/input test so the expected post-reset state is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100