I am trying to create a route on Angular 8 where a certain path has a public and private version so if i input /tracker in the URL the routing module can send me to the private/public version depending on if i am logged in or logged out.
I have tried Guards with CanActivate but this just stops the navigation if i return false, and i specifically need that both routes have the same path. This is my routing module:
path: '',
children: [
{
path: '',
canActivate: [AuthGuard],
component: TrackingListPrivateComponent
},
{
path: '',
component: TrackingListComponent
}
]
}
I expect to be able to input /tracker on the URL while being logged out and navigate to TrackingListComponent and after logged in to input /tracker on the URL and navigate to TrackingListPrivateComponent.