In Angular 10 I have the following entry inside my routes:
const routes = [
{ path:'my/target/:targetId', component: MyTargetComponent, data: { dataKey: 'dataValue} },
...
]
From anywhere inside my application, given any path (say my/target/55
) I need to be able to access all information contained inside the Route object that I used to define such route (in particular I need to read the data
field). Is there a built-in function in Angular 10 to do this?
UPDATE: I need to access information for urls that are NOT necessarily the url of the current page.