Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 49ef411

Browse files
refactor: loadChildren to work with ~/path and ./path both relative to app/ (#338)
It turns out the ./path for loadChildren have never worked as relative to the routes module, and was always expected to be relative to app/ in non-webpack builds. Modifying the lazy loaded ninjas to feature both ./ and ~/ paths relative to the app.
1 parent 715e13b commit 49ef411

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: demo/AngularApp/app/ninjas/ninjas.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import { Component } from "@angular/core";
66
<Label text="Ninjas!" class="h1 text-center"></Label>
77
88
<ListView [items]="ninjas" class="list-group">
9-
<ng-template let-ninja="item">
9+
<ng-template let-ninja="item" let-index="index">
1010
<Label
1111
class="list-group-item"
1212
color="white"
1313
[backgroundColor]="ninja.color"
1414
[text]="ninja.name"
15-
[nsRouterLink]="['details', ninja.name]"></Label>
15+
[nsRouterLink]="['details' + (index % 2 + 1) , ninja.name]"></Label>
1616
</ng-template>
1717
</ListView>
1818

Diff for: demo/AngularApp/app/ninjas/ninjas.routes.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ export const routes = [
66
component: NinjasComponent
77
},
88
{
9-
path: "details",
9+
path: "details1",
10+
loadChildren: "./ninjas/details/ninja.module#NinjaModule",
11+
},
12+
{
13+
path: "details2",
1014
loadChildren: "~/ninjas/details/ninja.module#NinjaModule",
1115
},
1216
];

0 commit comments

Comments
 (0)