mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-13 06:13: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>
|
<legend class="feedback-form-title">Tell us what you think</legend>
|
||||||
<input
|
<input
|
||||||
class="feedback-form-control"
|
class="feedback-form-control"
|
||||||
@@ -10,8 +13,7 @@
|
|||||||
[formControl]="feedbackForm.controls.email"
|
[formControl]="feedbackForm.controls.email"
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
type="text" />
|
type="text" />
|
||||||
<app-feedback-control (ratingUpdated)="rating = $event">
|
<app-rating-control (ratingUpdated)="rating = $event"> </app-rating-control>
|
||||||
</app-feedback-control>
|
|
||||||
<textarea
|
<textarea
|
||||||
class="feedback-form-control"
|
class="feedback-form-control"
|
||||||
[formControl]="feedbackForm.controls.comment"
|
[formControl]="feedbackForm.controls.comment"
|
||||||
@@ -20,9 +22,8 @@
|
|||||||
class="feedback-form-submit"
|
class="feedback-form-submit"
|
||||||
type="submit"
|
type="submit"
|
||||||
[disabled]="
|
[disabled]="
|
||||||
feedbackForm.touched && (rating === null || feedbackForm.invalid)
|
!feedbackForm.touched || rating === null || feedbackForm.invalid
|
||||||
"
|
">
|
||||||
(click)="submitForm()">
|
|
||||||
Submit
|
Submit
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import { Validators } from '@angular/forms';
|
|||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { ReactiveFormsModule } 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({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [FeedbackControlComponent, ReactiveFormsModule],
|
imports: [RatingControlComponent, ReactiveFormsModule],
|
||||||
selector: 'app-feedback-form',
|
selector: 'app-feedback-form',
|
||||||
templateUrl: 'feedback-form.component.html',
|
templateUrl: 'feedback-form.component.html',
|
||||||
styleUrls: ['feedback-form.component.scss'],
|
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({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: 'app-feedback-control',
|
selector: 'app-rating-control',
|
||||||
templateUrl: 'feedback-control.component.html',
|
templateUrl: 'rating-control.component.html',
|
||||||
styleUrls: ['feedback-control.component.scss'],
|
styleUrls: ['rating-control.component.scss'],
|
||||||
})
|
})
|
||||||
export class FeedbackControlComponent {
|
export class RatingControlComponent {
|
||||||
@Output()
|
@Output()
|
||||||
readonly ratingUpdated: EventEmitter<string> = new EventEmitter<string>();
|
readonly ratingUpdated: EventEmitter<string> = new EventEmitter<string>();
|
||||||
|
|
||||||
Reference in New Issue
Block a user