File tree 1 file changed +12
-7
lines changed
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -7,21 +7,26 @@ import {
7
7
} from '@angular/router' ;
8
8
9
9
import { RuntimeEnvironmentService } from 'app/core/runtime-environment.service' ;
10
+ import { FeaturesModule } from 'app/features/features.module' ;
10
11
import { environment } from 'environments/environment' ;
11
12
12
- // if you don't want to lazy load the features module,
13
- // simply put the loadFeaturesModule as value of loadChildren
14
- // import { FeaturesModule } from './features/features.module';
13
+ // if you want to lazy load the features module,
14
+ // 1 - remove the `import { FeaturesModule } from ...`;
15
+ // 2 - remove the loadFeaturesModule function
15
16
16
- // export function loadFeaturesModule() {
17
- // return FeaturesModule;
18
- // }
17
+ // we cannot use shorthand like that:
18
+ // loadChildren: () => FeaturesModule
19
+ // to be AOT compliant, we need to create
20
+ // a named function and export the module
21
+ export function loadFeaturesModule ( ) {
22
+ return FeaturesModule ;
23
+ }
19
24
20
25
const routes : Routes = [
21
26
{
22
27
path : '' ,
23
28
canActivate : [ RuntimeEnvironmentService ] ,
24
- loadChildren : 'app/features/features.module#FeaturesModule' ,
29
+ loadChildren : loadFeaturesModule ,
25
30
} ,
26
31
] ;
27
32
You can’t perform that action at this time.
0 commit comments