diff --git a/packages/@angular/cli/commands/generate.ts b/packages/@angular/cli/commands/generate.ts index 1434c224e6cd..2080de6c9898 100644 --- a/packages/@angular/cli/commands/generate.ts +++ b/packages/@angular/cli/commands/generate.ts @@ -145,7 +145,7 @@ export default Command.extend({ const cwd = this.project.root; const schematicName = rawArgs[0]; - if (schematicName === 'component' || schematicName === 'directive') { + if (['component', 'c', 'directive', 'd'].indexOf(schematicName) !== -1) { if (commandOptions.prefix === undefined) { commandOptions.prefix = appConfig.prefix; } diff --git a/tests/e2e/tests/generate/component/component-prefix.ts b/tests/e2e/tests/generate/component/component-prefix.ts index 2530e778bbfd..cb818f73c1d8 100644 --- a/tests/e2e/tests/generate/component/component-prefix.ts +++ b/tests/e2e/tests/generate/component/component-prefix.ts @@ -15,6 +15,9 @@ export default function() { .then(() => ng('generate', 'component', 'test-component')) .then(() => expectFileToMatch(join(componentDir, 'test-component.component.ts'), /selector: 'pre-/)) + .then(() => ng('g', 'c', 'alias')) + .then(() => expectFileToMatch(join('src', 'app', 'alias', 'alias.component.ts'), + /selector: 'pre-/)) // Try to run the unit tests. .then(() => ng('test', '--single-run'));