We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0633130 commit 7da07d9Copy full SHA for 7da07d9
docs/documentation/new.md
@@ -68,6 +68,16 @@ Default applications are created in a directory of the same name, with an initia
68
</p>
69
</details>
70
71
+<details>
72
+ <summary>animation</summary>
73
+ <p>
74
+ `--animation` _default value: false_
75
+ </p>
76
77
+ Generate with animation support.
78
79
+</details>
80
+
81
<details>
82
<summary>skip-commit</summary>
83
<p>
packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.spec.ts
@@ -1,13 +1,21 @@
1
import { TestBed, async } from '@angular/core/testing';<% if (routing) { %>
2
-import { RouterTestingModule } from '@angular/router/testing';<% } %>
+import { RouterTestingModule } from '@angular/router/testing';<% } %><% if (animation) { %>
3
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';<% } %>
4
5
import { AppComponent } from './app.component';
6
7
describe('AppComponent', () => {
8
beforeEach(async(() => {
- TestBed.configureTestingModule({<% if (routing) { %>
9
+ TestBed.configureTestingModule({<% if (routing && animation) { %>
10
+ imports: [
11
+ RouterTestingModule,
12
+ BrowserAnimationsModule
13
+ ],<% } %><% if (routing && !animation) { %>
14
imports: [
15
RouterTestingModule
16
+ ],<% } %><% if (animation && !routing) { %>
17
18
19
],<% } %>
20
declarations: [
21
AppComponent
packages/@angular/cli/blueprints/ng/files/__path__/app/app.module.ts
@@ -1,4 +1,5 @@
-import { BrowserModule } from '@angular/platform-browser';
+<% if (animation) { %>import { BrowserAnimationsModule } from '@angular/platform-browser/animations';<%
+} else { %>import { BrowserModule } from '@angular/platform-browser';<% } %>
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
@@ -10,8 +11,9 @@ import { AppComponent } from './app.component';
],
- imports: [
- BrowserModule,
+ imports: [<% if (animation) { %>
+ BrowserAnimationsModule,<% } else { %>
+ BrowserModule,<% } %>
FormsModule,
HttpModule<% if (routing) { %>,
AppRoutingModule<% } %>
packages/@angular/cli/blueprints/ng/files/package.json
@@ -19,7 +19,8 @@
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
22
- "@angular/router": "^4.0.0",
+ "@angular/router": "^4.0.0",<% if (animation) { %>
23
+ "@angular/animations": "^4.0.0",<% } %>
24
"core-js": "^2.4.1",
25
"rxjs": "^5.1.0",
26
"zone.js": "^0.8.4"
packages/@angular/cli/blueprints/ng/index.ts
@@ -13,6 +13,7 @@ export default Blueprint.extend({
{ name: 'prefix', type: String, default: 'app', aliases: ['p'] },
{ name: 'style', type: String },
{ name: 'routing', type: Boolean, default: false },
+ { name: 'animation', type: Boolean, default: false },
{ name: 'inline-style', type: Boolean, default: false, aliases: ['is'] },
{ name: 'inline-template', type: Boolean, default: false, aliases: ['it'] },
{ name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] }
@@ -53,6 +54,7 @@ export default Blueprint.extend({
53
54
styleExt: this.styleExt,
55
relativeRootPath: relativeRootPath,
56
routing: options.routing,
57
+ animation: options.animation,
58
inlineStyle: options.inlineStyle,
59
inlineTemplate: options.inlineTemplate,
60
tests: this.tests,
packages/@angular/cli/commands/new.ts
@@ -108,6 +108,12 @@ const NewCommand = Command.extend({
108
default: false,
109
description: 'Generate a routing module.'
110
},
111
+ {
112
+ name: 'animation',
113
+ type: Boolean,
114
+ default: false,
115
+ description: 'Generate with animation support.'
116
+ },
117
{
118
name: 'inline-style',
119
type: Boolean,
packages/@angular/cli/tasks/init.ts
@@ -74,6 +74,7 @@ export default Task.extend({
style: commandOptions.style,
prefix: commandOptions.prefix.trim() || 'app',
routing: commandOptions.routing,
+ animation: commandOptions.animation,
inlineStyle: commandOptions.inlineStyle,
inlineTemplate: commandOptions.inlineTemplate,
ignoredUpdateFiles: ['favicon.ico'],
tests/e2e/tests/commands/new/new-animation.ts
@@ -0,0 +1,11 @@
+import {ng} from '../../../utils/process';
+import {createProject} from '../../../utils/project';
+export default function() {
+ return Promise.resolve()
+ .then(() => createProject('animation-project', '--animation'))
+ // Try to run the unit tests.
+ .then(() => ng('test', '--single-run'));
+}
0 commit comments