From 74e69cec856843971049febfa2c0bda893c2d651 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Thu, 14 Aug 2025 19:23:43 +0700 Subject: [PATCH] feat(client): migrate to form control --- .../prompt-dialog/prompt-dialog.component.ts | 10 +++++----- .../core/notification/prompt-dialog/prompt-dialog.html | 9 +++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.component.ts b/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.component.ts index 6c8af4197..6ea68d863 100644 --- a/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.component.ts +++ b/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { FormsModule } from '@angular/forms'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatDialogModule, MatDialogRef } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; @@ -7,11 +7,11 @@ import { MatInputModule } from '@angular/material/input'; @Component({ imports: [ - FormsModule, MatButtonModule, MatDialogModule, MatFormFieldModule, - MatInputModule + MatInputModule, + ReactiveFormsModule ], selector: 'gf-prompt-dialog', templateUrl: './prompt-dialog.html' @@ -20,8 +20,8 @@ export class GfPromptDialogComponent { public confirmLabel: string; public defaultValue: string; public discardLabel: string; + public formControl = new FormControl(''); public title: string; - public value: string; public valueLabel: string; public constructor(public dialogRef: MatDialogRef) {} @@ -36,8 +36,8 @@ export class GfPromptDialogComponent { this.confirmLabel = aParams.confirmLabel; this.defaultValue = aParams.defaultValue; this.discardLabel = aParams.discardLabel; + this.formControl.setValue(aParams.defaultValue); this.title = aParams.title; - this.value = aParams.defaultValue; this.valueLabel = aParams.valueLabel; } } diff --git a/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.html b/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.html index 5568cfdae..17cbce604 100644 --- a/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.html +++ b/apps/client/src/app/core/notification/prompt-dialog/prompt-dialog.html @@ -7,7 +7,7 @@ @if (valueLabel) { {{ valueLabel }} } - + @@ -15,7 +15,12 @@ -