From 0b0beea9df7839a8bd01291c4892d8827b4f68cc Mon Sep 17 00:00:00 2001 From: nzbin Date: Sat, 7 Sep 2019 23:39:47 +0800 Subject: [PATCH] fix(schematics): fix routingModulePath in module schematic --- packages/schematics/angular/module/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/schematics/angular/module/index.ts b/packages/schematics/angular/module/index.ts index 83f5c5f67156..d02d6d63995f 100644 --- a/packages/schematics/angular/module/index.ts +++ b/packages/schematics/angular/module/index.ts @@ -115,7 +115,12 @@ function addRouteDeclarationToNgModule( function getRoutingModulePath(host: Tree, options: ModuleOptions): Path | undefined { let path: Path | undefined; const modulePath = options.module as string; - const routingModuleName = modulePath.split('.')[0] + '-routing'; + let routingModuleName = modulePath.split('.')[0] + '-routing'; + // Fix routingModuleName + // i.e. `/src/app/module/module-routing.module.ts` -> `/module/module-routing.module.ts` + if (options.path) { + routingModuleName = routingModuleName.replace(options.path, ''); + } const { module, ...rest } = options; try {