From 555f1844bc5c83256a7859e0fa0c8385ed6aec17 Mon Sep 17 00:00:00 2001 From: Ionut Achim Date: Fri, 22 Apr 2016 16:12:54 +0300 Subject: [PATCH] fix(routes): remove `+` for non-lazy routes import (#499) * fix(routes): remove `+` for non-lazy routes import - prepend `+` only for lazy routes' import path directories --- addon/ng2/blueprints/route/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addon/ng2/blueprints/route/index.js b/addon/ng2/blueprints/route/index.js index 4c4f776106..0bc72a0e88 100644 --- a/addon/ng2/blueprints/route/index.js +++ b/addon/ng2/blueprints/route/index.js @@ -17,7 +17,7 @@ module.exports = { { name: 'inline-template', type: Boolean, default: false, aliases: ['it'] }, { name: 'inline-style', type: Boolean, default: false, aliases: ['is'] } ], - + beforeInstall: function(options) { options.route = true; if (options.lazy) { @@ -40,7 +40,7 @@ module.exports = { var parsedPath = dynamicPathParser(this.project, entityName); this.dynamicPath = parsedPath; - + //leave the entity name intact for component generation return entityName; }, @@ -115,7 +115,7 @@ module.exports = { // Insert the import statement. let content = fs.readFileSync(parentFile, 'utf-8'); - const importTemplate = `import {${jsComponentName}Component} from './+${base}';`; + const importTemplate = `import {${jsComponentName}Component} from './${options.isLazyRoute ? '+' : ''}${base}';`; if (content.indexOf(importTemplate) != -1) { // Already there, do nothing.