Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
@ -29,11 +29,6 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
private toaster: ToasterService,
|
||||
private ser: EmployeeService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.listenToIsActiveChanges();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
code: { value: '', disabled: true },
|
||||
name: '',
|
||||
@ -45,10 +40,13 @@ export class EmployeeDetailComponent implements OnInit, AfterViewInit {
|
||||
joiningDate: '',
|
||||
leavingDate: '',
|
||||
});
|
||||
this.listenToIsActiveChanges();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { item: Employee; costCentres: CostCentre[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: Employee; costCentres: CostCentre[] };
|
||||
|
||||
this.costCentres = data.costCentres;
|
||||
this.showItem(data.item);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user