Skip to content

Is it possible to create tables within Angular ts files?

So I have an array which holds different categories to compare different companies. Depending on the user selection there may be 3 categories or 10 to display. I am looking for a dynamic way to insert tables on demand depending on how many categories are selected. Is there a library in Angular or around somewhere which can help with this task ?

I would rather not create 30 tables based off of categories and just hide the unwanted ones.

Thank you.

Answer

I’d use a grid and dynamically set the columns based on user selection as per your requirement.

I usually use ag-Grid library which is a fantastic easy to use library. The free version should suffice for your requirment. Have a look here, https://blog.ag-grid.com/binding-and-updating-column-definitions-in-ag-grid/