I want to display/hide routerLinks based on some Data from the router. The directive is done, but I'm missing the most essential part...
For example I have the following router config (omitted components):
[
  { path: '', children: [
    { path: 'foo', children: [
      { path: 'bar', data: { requiredPermissions: ['a', 'b'] } }
    ]}
  ]},
  { path: 'baz', data: { requiredPermissions: ['c'] }, children: [
    { path: ':id' }
  ]}
]
Now I'd like to ask the Router for the Route that would be used if the routerLink is /foo/bar or /baz/123.
I looked though the Router source code ( https://github.com/angular/angular/blob/master/modules/%40angular/router/src/router.ts ), but couldn't find some easy way to do this. Especially how it handles these :id variables.
Of course I could iterate over Router.config, going deeper and deeper. But then I'd have to parse those variables, regular expressions, etc. There must be an easier way, because the angular router must internally do all this stuff, too.
Do you have any idea / solution?
 
     
     
    