Chore: Moved from Untyped to Stongly Typed forms.

This commit is contained in:
2022-07-15 13:24:25 +05:30
parent facf2df91e
commit 28f9bf2180
78 changed files with 1091 additions and 1004 deletions

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { FormControl, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
@ -14,18 +14,18 @@ import { CashFlowDataSource } from './cash-flow-datasource';
export class CashFlowComponent implements OnInit {
info: CashFlow = new CashFlow();
dataSource: CashFlowDataSource = new CashFlowDataSource(CashFlow.Data(this.info));
form: UntypedFormGroup;
form: FormGroup<{
startDate: FormControl<Date>;
finishDate: FormControl<Date>;
}>;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'amount'];
constructor(
private route: ActivatedRoute,
private router: Router,
private fb: UntypedFormBuilder,
) {
this.form = this.fb.group({
startDate: '',
finishDate: '',
constructor(private route: ActivatedRoute, private router: Router) {
this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }),
});
}