Skip to content

Commit aaa899e

Browse files
authored
Merge branch 'master' into issue-template
2 parents d2b1688 + 00fe4cc commit aaa899e

File tree

9 files changed

+46
-8
lines changed

9 files changed

+46
-8
lines changed

docs/documentation/generate/service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
`--flat` Flag to indicate if a dir is created.
1212

13-
`--module` (`-m`) Allows specification of the declaring module.
13+
`--module` (`-m`) Allows you to specify the module where the service should be provided
1414

15-
`--spec` Specifies if a spec file is generated.
15+
`--spec` Specifies if a spec file is generated.

docs/documentation/home.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ End-to-end tests are run via [Protractor](https://angular.github.io/protractor/)
5050
* [ng e2e](e2e)
5151
* [ng build](build)
5252
* [ng get/ng set](config)
53-
* [ng docs](docs)
53+
* [ng doc](doc)
5454
* [ng eject](eject)
5555

5656
### Additional Information

packages/@angular/cli/blueprints/component/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ const getFiles = Blueprint.prototype.files;
1212
const stringUtils = require('ember-cli-string-utils');
1313
const astUtils = require('../../utilities/ast-utils');
1414

15+
const viewEncapsulationMap: any = {
16+
'emulated': 'Emulated',
17+
'native': 'Native',
18+
'none': 'None'
19+
};
20+
21+
const changeDetectionMap: any = {
22+
'default': 'Default',
23+
'onpush': 'OnPush'
24+
};
25+
26+
function correctCase(options: any) {
27+
if (options.viewEncapsulation) {
28+
options.viewEncapsulation = viewEncapsulationMap[options.viewEncapsulation.toLowerCase()];
29+
}
30+
31+
if (options.changeDetection) {
32+
options.changeDetection = changeDetectionMap[options.changeDetection.toLowerCase()];
33+
}
34+
}
35+
1536
export default Blueprint.extend({
1637
description: '',
1738

@@ -146,6 +167,8 @@ export default Blueprint.extend({
146167
options.changeDetection = options.changeDetection !== undefined ?
147168
options.changeDetection : CliConfig.getValue('defaults.component.changeDetection');
148169

170+
correctCase(options);
171+
149172
return {
150173
dynamicPath: this.dynamicPath.dir.replace(this.dynamicPath.appRoot, ''),
151174
flat: options.flat,

packages/@angular/cli/blueprints/module/files/__path__/__name__-routing.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const routes: Routes = [];
55

66
@NgModule({
77
imports: [RouterModule.forChild(routes)],
8-
exports: [RouterModule],
9-
providers: []
8+
exports: [RouterModule]
109
})
1110
export class <%= classifiedModuleName %>RoutingModule { }

packages/@angular/cli/blueprints/ng/files/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version <%= version %>.
44

55
## Development server
6+
67
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
78

89
## Code scaffolding

packages/@angular/cli/blueprints/ng/files/__path__/app/app-routing.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const routes: Routes = [
1010

1111
@NgModule({
1212
imports: [RouterModule.forRoot(routes)],
13-
exports: [RouterModule],
14-
providers: []
13+
exports: [RouterModule]
1514
})
1615
export class AppRoutingModule { }

packages/@angular/cli/blueprints/ng/files/gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ testem.log
3737
/e2e/*.js
3838
/e2e/*.map
3939

40-
#System Files
40+
# System Files
4141
.DS_Store
4242
Thumbs.db

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const aliasMap: { [alias: string]: string } = {
5757
'c': 'component',
5858
'd': 'directive',
5959
'e': 'enum',
60+
'g': 'guard',
6061
'i': 'interface',
6162
'm': 'module',
6263
'p': 'pipe',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {join} from 'path';
2+
import {ng} from '../../../utils/process';
3+
import {expectFileToMatch} from '../../../utils/fs';
4+
5+
6+
export default function() {
7+
const compDir = join('src', 'app', 'test');
8+
9+
return Promise.resolve()
10+
.then(() => ng('generate', 'component', 'test', '-cd', 'onpush', '-ve', 'emulated'))
11+
.then(() => expectFileToMatch(join(compDir, 'test.component.ts'),
12+
/changeDetection: ChangeDetectionStrategy.OnPush/))
13+
.then(() => expectFileToMatch(join(compDir, 'test.component.ts'),
14+
/encapsulation: ViewEncapsulation.Emulated/));
15+
}

0 commit comments

Comments
 (0)