Browse Source

feat(client): replace constructor based DI with inject functions

pull/7185/head
KenTandrian 2 weeks ago
parent
commit
3ffefb2bd4
  1. 13
      apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts

13
apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts

@ -1,6 +1,6 @@
import { GfValueComponent } from '@ghostfolio/ui/value'; import { GfValueComponent } from '@ghostfolio/ui/value';
import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { import {
@ -28,11 +28,12 @@ import { RuleSettingsDialogParams } from './interfaces/interfaces';
export class GfRuleSettingsDialogComponent { export class GfRuleSettingsDialogComponent {
protected readonly settingsForm: FormGroup; protected readonly settingsForm: FormGroup;
public constructor( protected readonly data = inject<RuleSettingsDialogParams>(MAT_DIALOG_DATA);
@Inject(MAT_DIALOG_DATA) protected readonly data: RuleSettingsDialogParams, protected readonly dialogRef =
protected readonly dialogRef: MatDialogRef<GfRuleSettingsDialogComponent>, inject<MatDialogRef<GfRuleSettingsDialogComponent>>(MatDialogRef);
private readonly formBuilder: FormBuilder private readonly formBuilder = inject(FormBuilder);
) {
public constructor() {
this.settingsForm = this.formBuilder.group({ this.settingsForm = this.formBuilder.group({
thresholdMax: [this.data.settings?.thresholdMax], thresholdMax: [this.data.settings?.thresholdMax],
thresholdMin: [this.data.settings?.thresholdMin] thresholdMin: [this.data.settings?.thresholdMin]

Loading…
Cancel
Save