Skip to content

Commit 1a89c94

Browse files
Broccohansl
authored andcommitted
fix(@angular/cli): Make prefix work when using aliases
fixes #7522
1 parent 90fddc5 commit 1a89c94

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/@angular/cli/commands/generate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export default Command.extend({
145145
const cwd = this.project.root;
146146
const schematicName = rawArgs[0];
147147

148-
if (schematicName === 'component' || schematicName === 'directive') {
148+
if (['component', 'c', 'directive', 'd'].indexOf(schematicName) !== -1) {
149149
if (commandOptions.prefix === undefined) {
150150
commandOptions.prefix = appConfig.prefix;
151151
}

tests/e2e/tests/generate/component/component-prefix.ts

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export default function() {
1515
.then(() => ng('generate', 'component', 'test-component'))
1616
.then(() => expectFileToMatch(join(componentDir, 'test-component.component.ts'),
1717
/selector: 'pre-/))
18+
.then(() => ng('g', 'c', 'alias'))
19+
.then(() => expectFileToMatch(join('src', 'app', 'alias', 'alias.component.ts'),
20+
/selector: 'pre-/))
1821

1922
// Try to run the unit tests.
2023
.then(() => ng('test', '--single-run'));

0 commit comments

Comments
 (0)