CreateComponent in async ngFor

Discussão em 'Angular' iniciado por DarkCid, Março 20, 2025.

  1. DarkCid

    DarkCid Guest

    I try to implement a tabs bar using infragistics and ngrx. In my app.component.html :

    <igx-tab-item *ngFor="let tab of tabs$ | async" (selectedChange)="selectTab(tab)">
    <igx-tab-header>
    <span igxTabHeaderLabel>{{ tab.label }}</span>
    </igx-tab-header>
    <igx-tab-content>
    <ng-container #container></ng-container>
    </igx-tab-content>
    </igx-tab-item>


    In my app.component.ts :

    @ViewChildren('container', { read: ViewContainerRef }) containers!: QueryList<ViewContainerRef>;
    public tabs$: Observable<TabItem[]> = this.tabManagerStore.select(selectTabs);
    ...
    public selectTab(tab: TabItem): void {
    const container = this.containers.get(tab.containerIndex);
    container.clear();
    const componentRef = container.createComponent(TabComponent);
    ...
    }


    But I've got this error when selected the tab : TypeError: can't define property "NG_ELEMENT_ID": Function is not extensible

    Can you help me ?

    Continue reading...

Compartilhe esta Página