在路由配置中传递参数
来源:3-3 在路由时传递数据

那些岁月
2017-06-17
{path: 'product', component: ProductComponent,data:[{ispod:true}]} => ActivatedRoute.data[0][ispod]
这个在ProductComponent的代码是什么样的,我自己试了很多遍都没有成功
写回答
2回答
-
那些岁月
提问者
2017-06-19
经过自己试验,已经成功
{path: 'company/:id/:name', component: CompanyComponent, data: {isProd: 'test'}}
CompanyComponent中
this.activatedRouter.data.subscribe((data) => this.isProd = data['isProd']);
112017-06-19 -
那些岁月
提问者
2017-06-17
这个老师在讲课的时候并没有具体实现
00
相似问题