【发布时间】:2021-06-01 22:55:06
【问题描述】:
我有一个组件,我想根据其中一个类别显示数据。 类别 - [运动、汽车、时尚、政治]。
在我的 NewsCategoriesComponent 中,我需要在单击导航按钮时显示更改的数据。
点击导航按钮后如何更改组件数据?
这是我的路线
const routes: Routes = [
{path: '', component: DashboardComponent},
{path: 'category', component: NewsCategoriesComponent},
{path: '**', component: DashboardComponent}
];
【问题讨论】:
-
很可能通过
Resolver读取ActivatedRoute并根据给定的category加载数据。 -
请添加在组件中显示项目的代码
标签: javascript angular routes angular2-routing