单击一个链接后,创建一个选项卡组件并在选项卡中显示一些动态数据



我有一个菜单,里面有一些选项(子菜单((不固定(。当我单击子菜单时,它应该在不同的选项卡中打开,其中包含我从某些 api 获取的数据集。每个子菜单都有不同的数据集。

我没有得到任何正确的想法来实现这一目标。

根据我从你的问题中了解到的一切,我将简要地尝试解释:

1.You will have to create different components for different views which will open on the click of each menu item
2.These components will have code which is displaying the data
3.You will also need a service to fetch the data which can be shared or separate according to your project's demand.
4.In the end you will need to use routing to navigate to these components. i.e each navigation item will have 'router-link' which is linked to the respective component.

请阅读路由 https://angular.io/guide/router 和服务。希望这有所帮助。

相关内容

最新更新