Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

70
Visualizações
Not able to dynamically attach component to ag-grid which is read as viewContainerRef

I am trying to attach one component dynamically as sibling to the ag-grid-angular. I have written an attribute directive which sits on top of the ag-grid and in the directive viewContainerRef is injected as below.

<ag-grid-angular tableDirective style="width: 100%;height:100%" class="ag-theme-balham" [rowData]="rowData" [suppressDragLeaveHidesColumns]="true" [getContextMenuItems]="getContextMenuItems" [enableRangeSelection]="true" [rowClassRules]="rowClassRules"
                [columnDefs]="columnDefs" [suppressMakeColumnVisibleAfterUnGroup]="true" [rowGroupPanelShow]="rowGroupPanelShow" (gridReady)="onGridReady($event)" [defaultColDef]="defaultColDef" [components]="components" [frameworkComponents]="frameworkComponents"
                [context]="context">
            </ag-grid-angular>

Inside of the directive I have a constructor like this.

@Directive({
  selector: 'tableDirective'
})
class TableDirective(){

constructor(private viewContainerRef: ViewContainerRef){}

      attachComponent(component: any, options) {
         const toolTipComponentFactory = this.componentFactoryResolver
          .resolveComponentFactory(component);
        this.viewContainerRef.createComponent(toolTipComponentFactory );
       }

}

I have a function to attach a component on some event of my choice. But I am not able to dynamically attach and If in case the component it is getting attached, Its attaching at some random place. Could someone help? Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda