Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
1 parent
30b1a3ef7d
commit
39e3cc51bb
52 files changed
+348
-448
No files matched your search
@@ -56,7 +56,14 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
private ser: VoucherService,
|
||||
private employeeSer: EmployeeService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
addRow: this.fb.group({
|
||||
employee: '',
|
||||
grossSalary: '',
|
||||
daysWorked: '',
|
||||
}),
|
||||
});
|
||||
this.setupEmployeeAutocomplete();
|
||||
}
|
||||
|
||||
@@ -83,7 +90,9 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher };
|
||||
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
}
|
||||
@@ -108,17 +117,6 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
|
||||
this.benefitsObservable.next(this.voucher.employeeBenefits);
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
addRow: this.fb.group({
|
||||
employee: '',
|
||||
grossSalary: '',
|
||||
daysWorked: '',
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
setupEmployeeAutocomplete(): void {
|
||||
const control = this.form.get('addRow').get('employee');
|
||||
this.employees = control.valueChanges.pipe(
|
||||
|
||||
Reference in new issue
Block a user