mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
refactor: rename FeedbackControl to RatingControl
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<form [formGroup]="feedbackForm" class="feedback-form">
|
||||
<form
|
||||
[formGroup]="feedbackForm"
|
||||
class="feedback-form"
|
||||
(ngSubmit)="submitForm()">
|
||||
<legend class="feedback-form-title">Tell us what you think</legend>
|
||||
<input
|
||||
class="feedback-form-control"
|
||||
@@ -10,8 +13,7 @@
|
||||
[formControl]="feedbackForm.controls.email"
|
||||
placeholder="Email"
|
||||
type="text" />
|
||||
<app-feedback-control (ratingUpdated)="rating = $event">
|
||||
</app-feedback-control>
|
||||
<app-rating-control (ratingUpdated)="rating = $event"> </app-rating-control>
|
||||
<textarea
|
||||
class="feedback-form-control"
|
||||
[formControl]="feedbackForm.controls.comment"
|
||||
@@ -20,9 +22,8 @@
|
||||
class="feedback-form-submit"
|
||||
type="submit"
|
||||
[disabled]="
|
||||
feedbackForm.touched && (rating === null || feedbackForm.invalid)
|
||||
"
|
||||
(click)="submitForm()">
|
||||
!feedbackForm.touched || rating === null || feedbackForm.invalid
|
||||
">
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -5,11 +5,11 @@ import { Validators } from '@angular/forms';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { FeedbackControlComponent } from '../feedback-control/feedback-control.component';
|
||||
import { RatingControlComponent } from '../rating-control/rating-control.component';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [FeedbackControlComponent, ReactiveFormsModule],
|
||||
imports: [RatingControlComponent, ReactiveFormsModule],
|
||||
selector: 'app-feedback-form',
|
||||
templateUrl: 'feedback-form.component.html',
|
||||
styleUrls: ['feedback-form.component.scss'],
|
||||
|
||||
|
Before Width: | Height: | Size: 547 B After Width: | Height: | Size: 547 B |
@@ -4,11 +4,11 @@ import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-feedback-control',
|
||||
templateUrl: 'feedback-control.component.html',
|
||||
styleUrls: ['feedback-control.component.scss'],
|
||||
selector: 'app-rating-control',
|
||||
templateUrl: 'rating-control.component.html',
|
||||
styleUrls: ['rating-control.component.scss'],
|
||||
})
|
||||
export class FeedbackControlComponent {
|
||||
export class RatingControlComponent {
|
||||
@Output()
|
||||
readonly ratingUpdated: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
||||
Reference in New Issue
Block a user