CanActivateChild
The canActivateChild
guard is similar to canActivate
, except that it is called when a child of the route is activated, and not the route itself.
Imagine a function that takes a URL and decides if the current user should be able to navigate to that URL. That means, we would like to check that any navigation is permitted. This is how we can accomplish this by using
canActivateChild
:
{ Â path: '', Â canActivateChild: [AllowUrl], Â children: [ Â Â Â { Â Â Â Â Â path: ':folder', Â Â Â Â Â children: [ Â Â Â Â Â Â Â { path: '', component: ConversationsCmp }, Â Â Â Â Â Â Â { path: ':id', component: ConversationCmp, children: [...]} Â Â Â Â Â ] Â Â Â }, Â Â Â { Â Â Â Â Â path: 'contacts', Â Â Â Â Â children...