Skip to content

Commit 9fb2340

Browse files
committed
add --create-module option for page
1 parent 48d566f commit 9fb2340

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

schematics/page/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export default function(options: PageOptions): Rule {
163163

164164
const templateSource = apply(url('./files'), [
165165
options.spec ? noop() : filter(p => !p.endsWith('.spec.ts')),
166+
options.createModule ? noop() : filter(p => !p.endsWith('.module.ts')),
166167
template({
167168
...strings,
168169
'if-flat': (s: string) => options.flat ? '' : s,
@@ -173,7 +174,7 @@ export default function(options: PageOptions): Rule {
173174

174175
return chain([
175176
branchAndMerge(chain([
176-
addRouteToNgModule(options),
177+
options.createModule ? addRouteToNgModule(options) : noop(),
177178
mergeWith(templateSource),
178179
])),
179180
])(host, context);

schematics/page/schema.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface Schema {
77
spec?: boolean;
88
flat?: boolean;
99
selector?: string;
10+
createModule?: boolean;
1011
module?: string;
1112
routePath?: string;
1213
}

schematics/page/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
"format": "html-selector",
6060
"description": "The selector to use for the page"
6161
},
62+
"createModule": {
63+
"type": "boolean",
64+
"description": "Allows creating an NgModule for the page",
65+
"default": true
66+
},
6267
"module": {
6368
"type": "string",
6469
"description": "Allows specification of the declaring module",

0 commit comments

Comments
 (0)