Skip to content

Commit b13b823

Browse files
authored
fix(routing): split out routes into routing module (#181)
1 parent 5b611c3 commit b13b823

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
import { <%= classify(name) %>Page } from './<%= dasherize(name) %>.page';
5+
6+
const routes: Routes = [
7+
{
8+
path: '',
9+
component: <%= classify(name) %>Page
10+
}
11+
];
12+
13+
@NgModule({
14+
imports: [RouterModule.forChild(routes)],
15+
exports: [RouterModule],
16+
})
17+
export class <%= classify(name) %>PageRoutingModule {}

schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.module.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
4-
import { Routes, RouterModule } from '@angular/router';
54

65
import { IonicModule } from '@ionic/angular';
76

8-
import { <%= classify(name) %>Page } from './<%= dasherize(name) %>.page';
7+
import { <%= classify(name) %>PageRoutingModule } from './<%= dasherize(name) %>-routing.module';
98

10-
const routes: Routes = [
11-
{
12-
path: '',
13-
component: <%= classify(name) %>Page
14-
}
15-
];
9+
import { <%= classify(name) %>Page } from './<%= dasherize(name) %>.page';
1610

1711
@NgModule({
1812
imports: [
1913
CommonModule,
2014
FormsModule,
2115
IonicModule,
22-
RouterModule.forChild(routes)
16+
<%= classify(name) %>PageRoutingModule
2317
],
2418
declarations: [<%= classify(name) %>Page]
2519
})

0 commit comments

Comments
 (0)