I have set up routes is like below
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'
},
];
now when i come to '/list'
route then on 'listing.component.ts'
i have written below code
export class ListingComponent {
public constructor(private router:Router) {
//here how i can get **data** of **list** routes
}
}
public constructor(private route:ActivatedRoute, private router:Router) {
console.log(route.snapshot.data['title'])
}