I want to check the active child route in parent component but I don't know how to get this. I am trying to use ActivatedRoute
but not able to get it.
I have tried both of the answers from Angular2 (rc4) - Check active child route in parent component:
I have tried the accepted answer:
constructor( private router:Router, private route: ActivatedRoute ) { var state = this.router.routerState var children = state.children(this.route) }
With this I am getting this error:
Property 'children' does not exist on type 'RouterState'
I have tried with this one as well:
this.router.events.filter(evt => evt instanceof NavigationEnd) .map(evt => evt.url) .subscribe(url => console.log(url));
but getting these error with this one:
property 'url' does not exist on type 'Event' property 'url' does not exist on type 'RouteConfigLoadStart'`
Any idea?