Skip to content

Commit 47e4111

Browse files
alan-agius4mgechev
authored andcommitted
refactor(@schematics/angular): clean up module schematic template
1 parent 9bec2d9 commit 47e4111

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/schematics/angular/module/files/__name@dasherize@if-flat__/__name@dasherize__.module.ts.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const routes: Routes = [
1111
@NgModule({
1212
declarations: [],
1313
imports: [<% if (commonModule) { %>
14-
CommonModule<%= routing || lazyRouteWithRouteModule ? ',' : '' %><% } %><% if (routing || lazyRouteWithRouteModule) { %>
15-
<%= classify(name) %>RoutingModule<% } %><%= lazyRouteWithoutRouteModule ? ',' : '' %><% if (lazyRouteWithoutRouteModule) { %>
14+
CommonModule<% } %><% if (routing || lazyRouteWithRouteModule) { %>,
15+
<%= classify(name) %>RoutingModule<% } %><% if (lazyRouteWithoutRouteModule) { %>,
1616
RouterModule.forChild(routes)<% } %>
1717
]
1818
})

packages/schematics/angular/module/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export default function (options: ModuleOptions): Rule {
139139
}
140140

141141
let routingModulePath: Path | undefined;
142-
const isLazyLoadedModuleGen = options.route && options.module;
142+
const isLazyLoadedModuleGen = !!(options.route && options.module);
143143
if (isLazyLoadedModuleGen) {
144144
options.routingScope = RoutingScope.Child;
145145
routingModulePath = getRoutingModulePath(host, options.module as string);
@@ -150,15 +150,15 @@ export default function (options: ModuleOptions): Rule {
150150
options.path = parsedPath.path;
151151

152152
const templateSource = apply(url('./files'), [
153-
options.routing || isLazyLoadedModuleGen && !!routingModulePath
153+
options.routing || (isLazyLoadedModuleGen && routingModulePath)
154154
? noop()
155155
: filter(path => !path.endsWith('-routing.module.ts.template')),
156156
applyTemplates({
157157
...strings,
158158
'if-flat': (s: string) => options.flat ? '' : s,
159159
lazyRoute: isLazyLoadedModuleGen,
160160
lazyRouteWithoutRouteModule: isLazyLoadedModuleGen && !routingModulePath,
161-
lazyRouteWithRouteModule: isLazyLoadedModuleGen && routingModulePath,
161+
lazyRouteWithRouteModule: isLazyLoadedModuleGen && !!routingModulePath,
162162
...options,
163163
}),
164164
move(parsedPath.path),

0 commit comments

Comments
 (0)