I am trying to load my custom component dynamically in my main page using custom accordion component
but it failed to load component inside component (child component)
CustomSimpleAccordionComponent.html:13 ERROR TypeError: templateRef.createEmbeddedView is not a function
at ViewContainerRef_.createEmbeddedView (core.js:26963)
at NgTemplateOutlet.ngOnChanges (common.js:5519)
at checkAndUpdateDirectiveInline (core.js:27784)
at checkAndUpdateNodeInline (core.js:38472)
at checkAndUpdateNode (core.js:38411)
at debugCheckAndUpdateNode (core.js:39433)
at debugCheckDirectivesFn (core.js:39376)
at Object.eval [as updateDirectives] (CustomSimpleAccordionComponent.html:13)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:39364)
at checkAndUpdateView (core.js:38376)
main-page : parent page from where all component imported
this.pageItems = [{ "listItem": "Details", "component": "appApproval" }];
<div *ngFor="let item of pageItems">
<ng-container>
<app-custom-simple-accordion
[accordionLabel]="item.listItem"
[itemTemplate]="item.component"
>
</app-custom-simple-accordion>
</ng-container>
</div>
<ng-template #appApproval>
<app-approval-flow> </app-approval-flow>
</ng-template>
app-custom-simple-accordion component : which load child component, passed from parent component
<li fd-list-item class="accordion">
{{ accordionLabel }}
<fd-list-action>
<button
fd-button
[options]="'light'"
(click)="toggleAccordion()"
[glyph]="isExpand ? 'navigation-up-arrow' : 'navigation-down-arrow'"
></button>
</fd-list-action>
</li>
<div *ngIf="isExpand" class="panel">
<ng-template [ngTemplateOutlet]="itemTemplate"></ng-template>
</div>
Thanks