Skip to content

Commit

Permalink
refactor(@schematics/angular): clean up module schematic template
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and mgechev committed Dec 3, 2019
1 parent 9bec2d9 commit 47e4111
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const routes: Routes = [
@NgModule({
declarations: [],
imports: [<% if (commonModule) { %>
CommonModule<%= routing || lazyRouteWithRouteModule ? ',' : '' %><% } %><% if (routing || lazyRouteWithRouteModule) { %>
<%= classify(name) %>RoutingModule<% } %><%= lazyRouteWithoutRouteModule ? ',' : '' %><% if (lazyRouteWithoutRouteModule) { %>
CommonModule<% } %><% if (routing || lazyRouteWithRouteModule) { %>,
<%= classify(name) %>RoutingModule<% } %><% if (lazyRouteWithoutRouteModule) { %>,
RouterModule.forChild(routes)<% } %>
]
})
Expand Down
6 changes: 3 additions & 3 deletions packages/schematics/angular/module/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function (options: ModuleOptions): Rule {
}

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

const templateSource = apply(url('./files'), [
options.routing || isLazyLoadedModuleGen && !!routingModulePath
options.routing || (isLazyLoadedModuleGen && routingModulePath)
? noop()
: filter(path => !path.endsWith('-routing.module.ts.template')),
applyTemplates({
...strings,
'if-flat': (s: string) => options.flat ? '' : s,
lazyRoute: isLazyLoadedModuleGen,
lazyRouteWithoutRouteModule: isLazyLoadedModuleGen && !routingModulePath,
lazyRouteWithRouteModule: isLazyLoadedModuleGen && routingModulePath,
lazyRouteWithRouteModule: isLazyLoadedModuleGen && !!routingModulePath,
...options,
}),
move(parsedPath.path),
Expand Down

0 comments on commit 47e4111

Please sign in to comment.