Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
@ -45,7 +45,11 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
private ser: LedgerService,
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
account: '',
|
||||
});
|
||||
|
||||
this.accounts = this.form.get('account').valueChanges.pipe(
|
||||
startWith(null),
|
||||
@ -57,7 +61,9 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { info: Ledger }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { info: Ledger };
|
||||
|
||||
this.info = data.info;
|
||||
this.calculateTotals();
|
||||
this.form.setValue({
|
||||
@ -115,14 +121,6 @@ export class LedgerComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
account: '',
|
||||
});
|
||||
}
|
||||
|
||||
getInfo(): Ledger {
|
||||
const formModel = this.form.value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user