diff --git a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts index 049bff2fd..a96f3aeea 100644 --- a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts +++ b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts @@ -7,7 +7,8 @@ import { CUSTOM_ELEMENTS_SCHEMA, inject, OnDestroy, - OnInit + OnInit, + signal } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; @@ -51,6 +52,8 @@ export class GfHistoricalMarketDataEditorDialogComponent public readonly data = inject(MAT_DIALOG_DATA); + protected readonly marketPrice = signal(this.data.marketPrice); + private readonly locale = this.data.user.settings.locale ?? inject(MAT_DATE_LOCALE); private readonly unsubscribeSubject = new Subject(); @@ -82,14 +85,14 @@ export class GfHistoricalMarketDataEditorDialogComponent }) .pipe(takeUntil(this.unsubscribeSubject)) .subscribe(({ marketPrice }) => { - this.data.marketPrice = marketPrice; + this.marketPrice.set(marketPrice); this.changeDetectorRef.markForCheck(); }); } public onUpdate() { - if (this.data.marketPrice === undefined) { + if (this.marketPrice() === undefined) { return; } @@ -100,7 +103,7 @@ export class GfHistoricalMarketDataEditorDialogComponent marketData: [ { date: this.data.dateString, - marketPrice: this.data.marketPrice + marketPrice: this.marketPrice() } ] }, diff --git a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html index 8e7e30649..7bb5827ef 100644 --- a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html +++ b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html @@ -28,7 +28,8 @@ matInput name="marketPrice" type="number" - [(ngModel)]="data.marketPrice" + [ngModel]="marketPrice()" + (ngModelChange)="marketPrice.set($event)" /> {{ data.currency }}