#angular #angular12
Вопрос:
У меня есть следующий код:
component.html:
<ng-container *ngIf="lazyComp" [ngComponentOutlet]="lazyComp | async"></ng-container>
компонент.ts:
lazyComp!: Promise<Type<LazytwoComponent>>;
...
load2() {
if (!this.lazyComp) {
this.lazyComp = import('./components/shared/lazytwo/lazytwo.component')
.then(({ LazytwoComponent }) => LazytwoComponent);
}
}
Ошибка заключается в:
Type 'Type<LazytwoComponent> | null' is not assignable to type 'Type<any>'.
Type 'null' is not assignable to type 'Type<any>'.
Как я могу это исправить?