Skip to content

Commit 19753ce

Browse files
committed
fix(generate): fix module component path if module is created in child folder
fixes #3063
1 parent f815228 commit 19753ce

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/angular-cli/blueprints/module/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ module.exports = {
5858
},
5959

6060
afterInstall: function (options) {
61-
options.entity.name = path.join(this.dasherizedModuleName, this.dasherizedModuleName);
62-
options.flat = true;
61+
options.entity.name = path.relative(this.dynamicPath.appRoot, this.generatePath);
62+
options.flat = false;
6363
options.route = false;
6464
options.inlineTemplate = false;
6565
options.inlineStyle = false;

tests/acceptance/generate-module.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,14 @@ describe('Acceptance: ng generate module', function () {
5656
expect(existsSync(path.join(testPath, 'two-word', 'two-word.module.spec.ts'))).to.equal(false);
5757
});
5858
});
59+
60+
it('ng generate module parent/child', function () {
61+
return ng(['generate', 'module', 'parent']).then(() =>
62+
ng(['generate', 'module', 'parent/child']).then(() => {
63+
expect(existsSync(path.join(testPath, 'parent/child', 'child.module.ts'))).to.equal(true);
64+
expect(existsSync(path.join(testPath, 'parent/child', 'child.module.spec.ts'))).to.equal(false);
65+
expect(existsSync(path.join(testPath, 'parent/child', 'child.component.ts'))).to.equal(true);
66+
})
67+
);
68+
});
5969
});

0 commit comments

Comments
 (0)