>();
readonly feedbackForm = new FormGroup({
name: new FormControl('', {
@@ -25,17 +23,14 @@ export class FeedbackFormComponent {
email: new FormControl('', {
validators: Validators.required,
}),
+ rating: new FormControl('', {
+ validators: Validators.required,
+ }),
comment: new FormControl(),
});
- rating: string | null = null;
-
submitForm(): void {
- this.feedBackSubmit.emit({
- ...this.feedbackForm.value,
- rating: this.rating,
- });
-
+ this.feedBackSubmit.emit(this.feedbackForm.value);
this.feedbackForm.reset();
}
}
diff --git a/apps/forms/41-control-value-accessor/src/app/rating-control/rating-control.component.html b/apps/forms/41-control-value-accessor/src/app/rating-control/rating-control.component.html
index 05b96c138..9e92235c1 100644
--- a/apps/forms/41-control-value-accessor/src/app/rating-control/rating-control.component.html
+++ b/apps/forms/41-control-value-accessor/src/app/rating-control/rating-control.component.html
@@ -5,7 +5,7 @@
- @for (item of [].constructor(5); track item) {
+ @for (item of [].constructor(5); track $index) {