I read some articles can't seem to implement lazy-loading my application. I have angular 8 installed and it seems I have the right syntax. Is there a specific strategy or way I need to have my components organized to get lazy loading to work?
This is the error message:
core.js:7187 ERROR Error: Uncaught (in promise): Error: ASSERTION ERROR: NgModule 'MyReportsGridComponent' is not a subtype of 'NgModuleType'.
Error: ASSERTION ERROR: NgModule 'MyReportsGridComponent' is not a subtype of 'NgModuleType'.
in my app.routing.module.ts where is what I have:
const routes: Routes = [
{path: '', component:LoginComponent},
{path: 'Login', component:LoginComponent},
{path: 'tasks', component:TaskComponent, canActivate:[AuthGuard]},
{path: 'CreateTask', loadChildren: () => import ('./create-task/create-task.component').then(m => m.CreateTaskComponent), canActivate:[AuthGuard]},
{path: 'ManageUser', loadChildren: () => import ('./manage-users/manage-users.component').then(m => m.ManageUsersComponent), canActivate:[AuthGuard]},
{path: 'MyReports', loadChildren: () => import ('./my-reports-grid/my-reports-grid.component').then(m => m.MyReportsGridComponent), canActivate:[AuthGuard]},
{path: 'CreateTeamName',loadChildren: () => import ('./create-new-team-name/create-new-team-name.component').then(m => m.CreateNewTeamNameComponent), canActivate:[AuthGuard]},
{path: 'ManageTeams',loadChildren: () => import ('./manage-teams/manage-teams.component').then(m => m.ManageTeamsComponent), canActivate:[AuthGuard]},
{ path: '**', component: PageNotFoundComponent },
{path: 'Register', component:RegisterComponent}
];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true, enableTracing: false, initialNavigation: true, onSameUrlNavigation: 'ignore' })],
exports: [RouterModule]
})
export class AppRoutingModule { }
Any suggestions?