我设置的路由如下所示
const appRoutes: Routes = [
{
path: 'login',
component: LoginComponent,
data: {
title: 'Login'
}
},
{
path: 'list',
component: ListingComponent,
data: {
title: 'Home Page',
module:'list'
}
},
{
path: '',
redirectTo: '/login',
pathMatch: 'full'
},
];
现在,当我来到'/list'
路,然后在'listing.component.ts'
我写了下面的代码
export class ListingComponent {
public constructor(private router:Router) {
//here how i can get **data** of **list** routes
}
}