I have the following routes configuration in app.module.ts,
{
path: 'login',
component: loginComponent,
canActivate: [loggerService]
}, {
path: '',
component: AppComponent,
canActivate: [loggerService]
}, {
path: '/home',
redirectTo: ''
}, {
path: '/blog',
component: BlogComponent,
canActivate: [loggerService]
}
When any of the routes is called, I want a method to run. For example, to log the access or pre-request some data. Is there any default user-defined or in-built method that can be used to achieve this?