Browse Source

feat(client): remove formBuilder injection

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

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

@ -1,14 +1,9 @@
import { GfSymbolAutocompleteComponent } from '@ghostfolio/ui/symbol-autocomplete'; import { GfSymbolAutocompleteComponent } from '@ghostfolio/ui/symbol-autocomplete';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { import {
ChangeDetectionStrategy,
Component,
inject,
OnInit
} from '@angular/core';
import {
FormBuilder,
FormControl, FormControl,
FormGroup,
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
ValidationErrors, ValidationErrors,
@ -36,15 +31,9 @@ import { CreateWatchlistItemForm } from './interfaces/interfaces';
styleUrls: ['./create-watchlist-item-dialog.component.scss'], styleUrls: ['./create-watchlist-item-dialog.component.scss'],
templateUrl: 'create-watchlist-item-dialog.html' templateUrl: 'create-watchlist-item-dialog.html'
}) })
export class GfCreateWatchlistItemDialogComponent implements OnInit { export class GfCreateWatchlistItemDialogComponent {
protected createWatchlistItemForm: CreateWatchlistItemForm; protected readonly createWatchlistItemForm: CreateWatchlistItemForm =
new FormGroup(
private readonly dialogRef =
inject<MatDialogRef<GfCreateWatchlistItemDialogComponent>>(MatDialogRef);
private readonly formBuilder = inject(FormBuilder);
public ngOnInit() {
this.createWatchlistItemForm = this.formBuilder.group(
{ {
searchSymbol: new FormControl<SymbolProfile | null>(null, [ searchSymbol: new FormControl<SymbolProfile | null>(null, [
Validators.required Validators.required
@ -54,7 +43,9 @@ export class GfCreateWatchlistItemDialogComponent implements OnInit {
validators: this.validator validators: this.validator
} }
); );
}
private readonly dialogRef =
inject<MatDialogRef<GfCreateWatchlistItemDialogComponent>>(MatDialogRef);
protected onCancel() { protected onCancel() {
this.dialogRef.close(); this.dialogRef.close();

Loading…
Cancel
Save