Browse Source

feat(client): implement inject function

pull/6724/head
KenTandrian 1 month ago
parent
commit
35778e2135
  1. 20
      apps/client/src/app/components/home-watchlist/create-watchlist-item-dialog/create-watchlist-item-dialog.component.ts

20
apps/client/src/app/components/home-watchlist/create-watchlist-item-dialog/create-watchlist-item-dialog.component.ts

@ -1,6 +1,11 @@
import { GfSymbolAutocompleteComponent } from '@ghostfolio/ui/symbol-autocomplete'; import { GfSymbolAutocompleteComponent } from '@ghostfolio/ui/symbol-autocomplete';
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import {
ChangeDetectionStrategy,
Component,
inject,
OnInit
} from '@angular/core';
import { import {
FormBuilder, FormBuilder,
FormControl, FormControl,
@ -32,12 +37,11 @@ import { CreateWatchlistItemForm } from './interfaces/interfaces';
templateUrl: 'create-watchlist-item-dialog.html' templateUrl: 'create-watchlist-item-dialog.html'
}) })
export class GfCreateWatchlistItemDialogComponent implements OnInit { export class GfCreateWatchlistItemDialogComponent implements OnInit {
public createWatchlistItemForm: CreateWatchlistItemForm; protected createWatchlistItemForm: CreateWatchlistItemForm;
public constructor( private readonly dialogRef =
public readonly dialogRef: MatDialogRef<GfCreateWatchlistItemDialogComponent>, inject<MatDialogRef<GfCreateWatchlistItemDialogComponent>>(MatDialogRef);
public readonly formBuilder: FormBuilder private readonly formBuilder = inject(FormBuilder);
) {}
public ngOnInit() { public ngOnInit() {
this.createWatchlistItemForm = this.formBuilder.group( this.createWatchlistItemForm = this.formBuilder.group(
@ -52,11 +56,11 @@ export class GfCreateWatchlistItemDialogComponent implements OnInit {
); );
} }
public onCancel() { protected onCancel() {
this.dialogRef.close(); this.dialogRef.close();
} }
public onSubmit() { protected onSubmit() {
this.dialogRef.close({ this.dialogRef.close({
dataSource: dataSource:
this.createWatchlistItemForm.controls.searchSymbol.value?.dataSource, this.createWatchlistItemForm.controls.searchSymbol.value?.dataSource,

Loading…
Cancel
Save