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