Answer the question
In order to leave comments, you need to log in
How to create components dynamically based on data with API using Angular?
Functional description:
The user has the ability to add tabs (as in a browser), in each tab he can select charts from the list for display. Those. as a result, it can have several tabs, each of which has a different set of charts. The binding goes to the account, so I think there will be an API for saving and receiving data about the structure of tabs and charts.
Question: what is the best way to implement this? In what form is the data stored? What functionality of Angular allows you to best implement this? Interested in best practice
Answer the question
In order to leave comments, you need to log in
In general, dynamic components are implemented using a router. In your case, each tab is some unique path. The list of tabs is loaded via the API, and based on the loaded data, an array is formed like
[
{ name: 'Chart 1', routerLink: ['/chart-1']},
{ name: 'Chart 2 ', routerLink: ['/chart-2']},
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question