我必须在angular2中传递路由数据。但是,我们要求这些数据是动态的。如果可能或不在angular2?
const routes: RouterConfig = [
{path: '', redirectTo: '/heroes', pathMatch : 'full'},
{path : 'heroes', component : HeroDetailComponent, data : {some_data : variable_dyanamic_data}}
];
答案 0 :(得分:-1)
使用:
传递动态数据
const routes: RouterConfig = [
{path: '', redirectTo: '/heroes', pathMatch : 'full'},
{path : 'heroes/:some_data', component : HeroDetailComponent}
];
修改: - 了解更多Read this