Skip to content

Commit e3fe78f

Browse files
Merge pull request #2697 from NGorco/docs/better_nested_routing_explanation
docs(router-module): better nested routing explanation
2 parents c6fb6e3 + 4c65674 commit e3fe78f

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

content/recipes/router-module.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,29 @@ In addition, you can define hierarchical structures. This means each module can
3131
The children modules will inherit their parent's prefix. In the following example, we'll register the `AdminModule` as a parent module of `DashboardModule` and `MetricsModule`.
3232

3333
```typescript
34-
RouterModule.register([
35-
{
36-
path: 'admin',
37-
module: AdminModule,
38-
children: [
39-
{
40-
path: 'dashboard',
41-
module: DashboardModule,
42-
},
34+
@Module({
35+
imports: [
36+
AdminModule,
37+
DashboardModule,
38+
MetricsModule,
39+
RouterModule.register([
4340
{
44-
path: 'metrics',
45-
module: MetricsModule,
41+
path: 'admin',
42+
module: AdminModule,
43+
children: [
44+
{
45+
path: 'dashboard',
46+
module: DashboardModule,
47+
},
48+
{
49+
path: 'metrics',
50+
module: MetricsModule,
51+
},
52+
],
4653
},
47-
],
48-
},
49-
]);
54+
])
55+
],
56+
});
5057
```
5158

5259
> info **Hint** This feature should be used very carefully, as overusing it can make code difficult to maintain over time.

0 commit comments

Comments
 (0)