Skip to content

Commit

Permalink
fix(@angular/cli): Make prefix work when using aliases
Browse files Browse the repository at this point in the history
fixes #7522
  • Loading branch information
Brocco authored and hansl committed Sep 13, 2017
1 parent 990b652 commit bc58afe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@angular/cli/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/tests/generate/component/component-prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit bc58afe

Please sign in to comment.