I have searched quite a bit and couldn't find any answer that solved my problem. So I am posting this question.
My issue is very similar to this question. Angular 2.0.1 Router EmptyError: no elements in sequence
But I couldn't resolve it even by adding pathMatch: 'full',.
I am getting an intermittent zonewaware error when try to navigate from a list table (navigates to detail view) below is my module.
@NgModule({
imports: [
CommonModule,
RouterModule.forChild([
{
path: 'teams',
component: TeamsListComponent,
pathMatch: 'full',
resolve: {
TeamTemplate: TeamListTemplatesResolver
},
canActivate: [AuthenticatedGuard]
}, {
path: 'teams/:id',
component: TeamFormComponent,
pathMatch: 'full',
resolve: {
team: TeamFormTeamResolver,
resources: TeamFormResourcesResolver
},
canActivate: [AuthenticatedGuard]
}
]),
my authGuard service has a canActivate method which just returns a boolean.
public canActivate(): boolean {
if (this.authService.isLoggedIn()) {
return true;
}
this.router.navigate(['/logout', { redirect: location.pathname }]);
return false;
}
And here is the error: Zone aware error
I could get a router event log with {enableTracing: true}:
Router Event: NavigationStart
Router Event: RoutesRecognized
Router Event: GuardsCheckStart
Router Event: GuardsCheckEnd
Router Event: ResolveStart
Router Event: NavigationError