Answer the question
In order to leave comments, you need to log in
Why does lazy loading load all js files to the client?
app.routing.module.ts file
const routes: Routes = [
{ path: '', loadChildren: () => import('./threads-lazy/threads-lazy.module').then(m => m.ThreadsLazyModule) },
{ path: 'thread/:guid', loadChildren: () => import('./thread-lazy/thread-lazy.module').then(m => m.ThreadLazyModule) },
];
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ThreadLazyRoutingModule } from './thread-lazy-routing.module';
import { ThreadComponent } from './thread/thread.component';
@NgModule({
declarations: [ThreadComponent],
imports: [
CommonModule,
ThreadLazyRoutingModule
]
})
export class ThreadLazyModule { }
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ThreadComponent } from './thread/thread.component';
const routes: Routes = [
{
path: '', component: ThreadComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ThreadLazyRoutingModule { }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question