Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 320920e

Browse files
authored
docs(ngmodule): replace export default with explicit export (#2206)
Because AoT won't support `export default` for RC6.
1 parent 82539b6 commit 320920e

File tree

6 files changed

+14
-28
lines changed

6 files changed

+14
-28
lines changed
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { ModuleWithProviders } from '@angular/core';
2-
import { Routes,
3-
RouterModule } from '@angular/router';
1+
import { ModuleWithProviders } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
43

54
export const routes: Routes = [
65
{ path: '', redirectTo: 'contact', pathMatch: 'full'},
7-
{ path: 'crisis', loadChildren: 'app/crisis/crisis.module' },
8-
{ path: 'heroes', loadChildren: 'app/hero/hero.module.3' }
6+
{ path: 'crisis', loadChildren: 'app/crisis/crisis.module#CrisisModule' },
7+
{ path: 'heroes', loadChildren: 'app/hero/hero.module.3#HeroModule' }
98
];
109

1110
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);

public/docs/_examples/ngmodule/ts/app/app.routing.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// #docregion
2-
import { ModuleWithProviders } from '@angular/core';
3-
import { Routes,
4-
RouterModule } from '@angular/router';
2+
import { ModuleWithProviders } from '@angular/core';
3+
import { Routes, RouterModule } from '@angular/router';
54

65
export const routes: Routes = [
76
{ path: '', redirectTo: 'contact', pathMatch: 'full'},
87
// #docregion lazy-routes
9-
{ path: 'crisis', loadChildren: 'app/crisis/crisis.module' },
10-
{ path: 'heroes', loadChildren: 'app/hero/hero.module' }
8+
{ path: 'crisis', loadChildren: 'app/crisis/crisis.module#CrisisModule' },
9+
{ path: 'heroes', loadChildren: 'app/hero/hero.module#HeroModule' }
1110
// #enddocregion lazy-routes
1211
];
1312

public/docs/_examples/ngmodule/ts/app/crisis/crisis.module.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ import { routing } from './crisis.routing';
1111
declarations: [ CrisisDetailComponent, CrisisListComponent ],
1212
providers: [ CrisisService ]
1313
})
14-
// #docregion export-default
15-
export default class CrisisModule {}
16-
// #enddocregion export-default
14+
export class CrisisModule {}

public/docs/_examples/ngmodule/ts/app/hero/hero.module.3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ import { HeroService } from './hero.service';
2121
HighlightDirective
2222
]
2323
})
24-
export default class HeroModule { }
24+
export class HeroModule { }
2525
// #enddocregion class

public/docs/_examples/ngmodule/ts/app/hero/hero.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ import { HeroService } from './hero.service';
1818
HeroComponent, HeroDetailComponent, HeroListComponent,
1919
]
2020
})
21-
export default class HeroModule { }
21+
export class HeroModule { }

public/docs/ts/latest/guide/ngmodule.jade

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -684,19 +684,9 @@ a#lazy-load
684684
+makeExample('ngmodule/ts/app/app.routing.ts', 'lazy-routes')(format='.')
685685
.l-sub-section
686686
:marked
687-
Note that the lazy loaded module location is a _string_, not a _type_.
688-
689-
To reference the _type_ we'd have to use a JavaScript import statement to get the module symbol,
690-
which loads the module immediately, defeating our intent to load the module later.
691-
692-
A string, on the other hand, is just a string. It has no side-effects.
693-
:marked
694-
The module location strings in this app identify module _files_, not module _classes_.
695-
That works because each module class is marked as the default export in its file.
696-
+makeExample('ngmodule/ts/app/crisis/crisis.module.ts', 'export-default', '/app/crisis/crisis.module.ts (export default)')(format='.')
697-
:marked
698-
_Remember to use_ `export default`_ for the lazy loaded module class.
699-
Continue to use `export` for all other classes.
687+
A lazy loaded module location is a _string_, not a _type_.
688+
In this app, the string identifies both the module _file_ and the module _class_,
689+
the latter separated from the former by a `#`.
700690

701691
:marked
702692
### RouterModule.forRoot

0 commit comments

Comments
 (0)