简体   繁体   中英

How to dynamically give ID to ag-grid?

I am using ag-grid for dataTables. I have created a component which consists of ag-grid. A unique ID is passed as input to this component and I want to give this id as grid id.

<ag-grid-ng2 #agGrid class="ag-fresh" [gridOptions]="gridOptions" [columnDefs]="columnDefs"
[rowData]="rowData">

So i want to make this id #agGrid to be dynamic.

How can I achieve this ?

您应该能够使用以下任何一项来设置唯一ID:

  • [id]="dynamicId"
  • [attr.id]="dynamicId"
  • id={{item.dynamicId}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM