Browse Source

feat(client): migrate to view child signal

pull/7265/head
KenTandrian 1 week ago
parent
commit
b9a8b2976e
  1. 11
      apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts

11
apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts

@ -17,7 +17,7 @@ import {
inject, inject,
Input, Input,
OnChanges, OnChanges,
ViewChild viewChild
} from '@angular/core'; } from '@angular/core';
import { IonIcon } from '@ionic/angular/standalone'; import { IonIcon } from '@ionic/angular/standalone';
import { CountUp } from 'countup.js'; import { CountUp } from 'countup.js';
@ -43,7 +43,8 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
@Input() showDetails: boolean; @Input() showDetails: boolean;
@Input() unit: string; @Input() unit: string;
@ViewChild('value') private value: ElementRef; private readonly value =
viewChild.required<ElementRef<HTMLSpanElement>>('value');
private readonly notificationService = inject(NotificationService); private readonly notificationService = inject(NotificationService);
@ -55,8 +56,8 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
this.precision = this.precision >= 0 ? this.precision : 2; this.precision = this.precision >= 0 ? this.precision : 2;
if (this.isLoading) { if (this.isLoading) {
if (this.value?.nativeElement) { if (this.value().nativeElement) {
this.value.nativeElement.innerHTML = ''; this.value().nativeElement.innerHTML = '';
} }
} else { } else {
if (isNumber(this.performance?.currentValueInBaseCurrency)) { if (isNumber(this.performance?.currentValueInBaseCurrency)) {
@ -78,7 +79,7 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
} }
).start(); ).start();
} else { } else {
this.value.nativeElement.innerHTML = '*****'; this.value().nativeElement.innerHTML = '*****';
} }
} }
} }

Loading…
Cancel
Save