Angular loadChildren with sub folder Viewdestroyederror error: Attempt to use a destroyed view: detectChanges

Asked

Viewed 35 times

0

I have the following scenario.

My app.routes.ts have got:

{ path: 'workflow', loadChildren: () => import('./workflow/workflow.module').then(m => m.WorkflowModule) }

In my workflow folder I have the workflow.routes.ts file with the following information:

import { InboxComponent } from "./inbox/inbox.component";
import { UsuarioComponent } from './cadastros/usuario/usuario.component';

export const WorkflowRouterConfig: Routes = [
    {
        path: '', component: WorkflowComponent,
        children: [            
            { path: 'inbox',canActivate: [AuthService], component: InboxComponent },
            { path: 'usuario',canActivate: [AuthService], component: UsuarioComponent }            
        ]
    }    
];

in my Nav bar:

<a class="dropdown-item" [routerLink]="['/workflow/usuario']">Usuário</a>

shows the error when clicking on the link: Error: Viewdestroyederror: Attempt to use a destroyed view: detectChanges

the problem I see is that I am trying to access a subfolder inside the workflow called Registrations inside it I have user comment.

  • Has an outlet router inside your Workflowcomponent?

  • Yes follow, import { Component } from '@angular/core'; @Component({ template: &#xA; <router-outlet></router-outlet>&#xA; }) export class Workflowcomponent { public constructor(){ } }

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.