Skip to content

Commit a5e8af1

Browse files
author
Mathou54
authored
Merge branch 'master' into master
2 parents 4bdb97c + c27cc85 commit a5e8af1

File tree

9 files changed

+45
-10
lines changed

9 files changed

+45
-10
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,13 @@ source ~/.bash_profile
298298

299299
### Project assets
300300

301-
You can add any files you want copied as-is to `src/assets/`.
301+
You use the `assets` array in `angular-cli.json` to list files or folders you want to copy as-is when building your project:
302+
```json
303+
"assets": [
304+
"assets",
305+
"favicon.ico"
306+
]
307+
```
302308

303309
### Global styles
304310

packages/angular-cli/blueprints/component/files/__path__/__name__.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, OnInit<% if(viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection) { %>, ChangeDetectionStrategy<% }%> } from '@angular/core';
22

33
@Component({
44
selector: '<%= selector %>',<% if(inlineTemplate) { %>
@@ -9,7 +9,9 @@ import { Component, OnInit } from '@angular/core';
99
`,<% } else { %>
1010
templateUrl: './<%= dasherizedModuleName %>.component.html',<% } if(inlineStyle) { %>
1111
styles: []<% } else { %>
12-
styleUrls: ['./<%= dasherizedModuleName %>.component.<%= styleExt %>']<% } %>
12+
styleUrls: ['./<%= dasherizedModuleName %>.component.<%= styleExt %>']<% } %><% if(viewEncapsulation) { %>,
13+
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection) { %>,
14+
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
1315
})
1416
export class <%= classifiedModuleName %>Component implements OnInit {
1517

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ module.exports = {
1616
{ name: 'inline-template', type: Boolean, aliases: ['it'] },
1717
{ name: 'inline-style', type: Boolean, aliases: ['is'] },
1818
{ name: 'prefix', type: Boolean, default: true },
19-
{ name: 'spec', type: Boolean }
19+
{ name: 'spec', type: Boolean },
20+
{ name: 'view-encapsulation', type: String, aliases: ['ve'] },
21+
{ name: 'change-detection', type: String, aliases: ['cd'] }
2022
],
2123

2224
beforeInstall: function() {
@@ -68,6 +70,14 @@ module.exports = {
6870
options.spec :
6971
this.project.ngConfigObj.get('defaults.spec.component');
7072

73+
options.viewEncapsulation = options.viewEncapsulation !== undefined ?
74+
options.viewEncapsulation :
75+
this.project.ngConfigObj.get('defaults.viewEncapsulation');
76+
77+
options.changeDetection = options.changeDetection !== undefined ?
78+
options.changeDetection :
79+
this.project.ngConfigObj.get('defaults.changeDetection');
80+
7181
return {
7282
dynamicPath: this.dynamicPath.dir.replace(this.dynamicPath.appRoot, ''),
7383
flat: options.flat,
@@ -77,7 +87,9 @@ module.exports = {
7787
route: options.route,
7888
isAppComponent: !!options.isAppComponent,
7989
selector: this.selector,
80-
styleExt: this.styleExt
90+
styleExt: this.styleExt,
91+
viewEncapsulation: options.viewEncapsulation,
92+
changeDetection: options.changeDetection
8193
};
8294
},
8395

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { NgModule } from '@angular/core';
22
import { Routes, RouterModule } from '@angular/router';
33

4-
const routes: Routes = [];
4+
const routes: Routes = [
5+
{
6+
path: '',
7+
children: []
8+
}
9+
];
510

611
@NgModule({
712
imports: [RouterModule.forRoot(routes)],
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<h1>
22
{{title}}
3-
</h1>
3+
</h1><% if (routing) { %>
4+
<router-outlet></router-outlet><% } %>

packages/angular-cli/lib/config/schema.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export interface CliConfig {
6060
styleExt?: string;
6161
prefixInterfaces?: boolean;
6262
poll?: number;
63+
viewEncapsulation?: string;
64+
changeDetection?: string;
6365
inline?: {
6466
style?: boolean;
6567
template?: boolean;

packages/angular-cli/lib/config/schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"items": {
3838
"type": "string"
3939
},
40-
"default": []
40+
"default": []
4141
},
4242
"index": {
4343
"type": "string",
@@ -144,6 +144,12 @@
144144
"poll": {
145145
"type": "number"
146146
},
147+
"viewEncapsulation": {
148+
"type": "string"
149+
},
150+
"changeDetection": {
151+
"type": "string"
152+
},
147153
"inline": {
148154
"type": "object",
149155
"properties": {

packages/angular-cli/utilities/completion.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ init_opts='--dry-run inline-style inline-template --link-cli --mobile --name --p
1616
new_opts='--directory --dry-run inline-style inline-template --link-cli --mobile --prefix --routing --skip-bower --skip-git --skip-npm --source-dir --style --verbose -d -dir -is -it -lc -p -sb -sd -sg -sn -v'
1717
serve_opts='--aot --environment --host --live-reload --live-reload-base-url --live-reload-host --live-reload-live-css --live-reload-port --open --port --proxy-config --ssl --ssl-cert --ssl-key --target --watcher -H -e -lr -lrbu -lrh -lrp -o -p -pc -t -w'
1818
set_opts='--global -g'
19-
test_opts='--browsers --build --colors --log-level --port --reporters --watch -w'
19+
test_opts='--browsers --build --code-coverage --colors --lint --log-level --port --reporters --watch -cc -l -w'
20+
2021
version_opts='--verbose'
2122

2223
if test ".$(type -t complete 2>/dev/null || true)" = ".builtin"; then

packages/ast-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"dependencies": {
2727
"@angular/tsc-wrapped": "^0.3.0",
28-
"rxjs": "5.0.0-beta.11",
28+
"rxjs": "5.0.0-beta.12",
2929
"denodeify": "^1.2.1",
3030
"typescript": "~2.0.3"
3131
}

0 commit comments

Comments
 (0)