docs: update to Angular 4.0 (#3415)

This commit is contained in:
Filipe Silva 2017-03-24 02:50:10 +00:00 committed by Ward Bell
parent 77af42dba9
commit 338e9e9438
44 changed files with 578 additions and 132 deletions

View File

@ -10,8 +10,9 @@ env:
- DBUS_SESSION_BUS_ADDRESS=/dev/null - DBUS_SESSION_BUS_ADDRESS=/dev/null
- DISPLAY=:99.0 - DISPLAY=:99.0
- CHROME_BIN=chromium-browser - CHROME_BIN=chromium-browser
- LATEST_RELEASE=2.4.0 - LATEST_RELEASE=4.0.0
- LATEST_RELEASE_BRANCH=2.4.x # Temporarily disabled until there is a new release branch for 4.0.0
# - LATEST_RELEASE_BRANCH=2.4.x
- TASK_FLAGS="--dgeni-log=warn" - TASK_FLAGS="--dgeni-log=warn"
matrix: matrix:
# current angular release jobs # current angular release jobs
@ -19,8 +20,8 @@ env:
- TASK="run-e2e-tests --fast" SCRIPT=examples-install.sh - TASK="run-e2e-tests --fast" SCRIPT=examples-install.sh
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v" - TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
# current angular release branch jobs # current angular release branch jobs
- TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH # - TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH
- TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v" # - TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
# angular master jobs # angular master jobs
- TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=master - TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=master
- TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=master WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v" - TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=master WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
@ -29,8 +30,8 @@ matrix:
allow_failures: allow_failures:
# allow current angular release branch and master to fail # allow current angular release branch and master to fail
# these should be moved to a daily task instead of being ran on every PR # these should be moved to a daily task instead of being ran on every PR
- env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH # - env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v" # - env: TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=$LATEST_RELEASE_BRANCH WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
- env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=master - env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh PREVIEW_BRANCH=master
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=master WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v" - env: TASK=build-compile SCRIPT=deploy-install-preview.sh PREVIEW_BRANCH=master WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
before_install: before_install:

View File

@ -71,13 +71,13 @@ var _devguideShredJadeOptions = {
var _apiShredOptions = { var _apiShredOptions = {
lang: 'ts', lang: 'ts',
examplesDir: path.join(ANGULAR_PROJECT_PATH, 'modules/@angular/examples'), examplesDir: path.join(ANGULAR_PROJECT_PATH, 'packages/examples'),
fragmentsDir: path.join(DOCS_PATH, '_fragments/_api'), fragmentsDir: path.join(DOCS_PATH, '_fragments/_api'),
zipDir: path.join(RESOURCES_PATH, 'zips/api'), zipDir: path.join(RESOURCES_PATH, 'zips/api'),
logLevel: _dgeniLogLevel logLevel: _dgeniLogLevel
}; };
var _excludePatterns = ['**/node_modules/**', '**/packages/**']; var _excludePatterns = ['**/node_modules/**'];
var _excludeMatchers = _excludePatterns.map(function(excludePattern){ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
return new Minimatch(excludePattern) return new Minimatch(excludePattern)
@ -1197,7 +1197,7 @@ function devGuideExamplesWatch(shredOptions, postShredAction, focus) {
// var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*'); // var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*');
// gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) { // gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) {
var ignoreThese = [ '**/node_modules/**', '**/_fragments/**', '**/dist/**', var ignoreThese = [ '**/node_modules/**', '**/_fragments/**', '**/dist/**',
'**/dart/.pub/**', '**/dart/build/**', '**/dart/packages/**']; '**/dart/.pub/**', '**/dart/build/**'];
ignoreThese = ignoreThese.concat(_exampleBoilerplateFiles.map((file) => `public/docs/_examples/*/*/${file}`)); ignoreThese = ignoreThese.concat(_exampleBoilerplateFiles.map((file) => `public/docs/_examples/*/*/${file}`));
var files = globby.sync( [includePattern], { ignore: ignoreThese }); var files = globby.sync( [includePattern], { ignore: ignoreThese });
gulp.watch([files], {readDelay: 500}, function (event, done) { gulp.watch([files], {readDelay: 500}, function (event, done) {

View File

@ -14,15 +14,20 @@
'app': 'app', 'app': 'app',
// angular bundles // angular bundles
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js', '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js', '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js', '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js', '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js', '@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',
// other libraries // other libraries
'rxjs': 'npm:rxjs', 'rxjs': 'npm:rxjs',

View File

@ -38,10 +38,13 @@
'app': 'app', 'app': 'app',
// angular bundles // angular bundles
'@angular/animations': 'ng:animations-builds/master/bundles/animations.umd.js',
'@angular/animations/browser': 'ng:animations-builds/master/bundles/animations-browser.umd.js',
'@angular/core': 'ng:core-builds/master/bundles/core.umd.js', '@angular/core': 'ng:core-builds/master/bundles/core.umd.js',
'@angular/common': 'ng:common-builds/master/bundles/common.umd.js', '@angular/common': 'ng:common-builds/master/bundles/common.umd.js',
'@angular/compiler': 'ng:compiler-builds/master/bundles/compiler.umd.js', '@angular/compiler': 'ng:compiler-builds/master/bundles/compiler.umd.js',
'@angular/platform-browser': 'ng:platform-browser-builds/master/bundles/platform-browser.umd.js', '@angular/platform-browser': 'ng:platform-browser-builds/master/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'ng:animations-builds/master/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'ng:platform-browser-dynamic-builds/master/bundles/platform-browser-dynamic.umd.js', '@angular/platform-browser-dynamic': 'ng:platform-browser-dynamic-builds/master/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'ng:http-builds/master/bundles/http.umd.js', '@angular/http': 'ng:http-builds/master/bundles/http.umd.js',
'@angular/router': 'ng:router-builds/master/bundles/router.umd.js', '@angular/router': 'ng:router-builds/master/bundles/router.umd.js',
@ -64,7 +67,7 @@
'rxjs': 'npm:rxjs@5.0.1', 'rxjs': 'npm:rxjs@5.0.1',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js', 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js', 'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.0.10/lib/typescript.js', 'typescript': 'npm:typescript@2.2.1/lib/typescript.js',
}, },
// packages tells the System loader how to load when no filename and/or no extension // packages tells the System loader how to load when no filename and/or no extension

View File

@ -35,10 +35,13 @@
'app': 'app', 'app': 'app',
// angular bundles // angular bundles
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js', '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js', '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js', '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js', '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
@ -51,7 +54,7 @@
'rxjs': 'npm:rxjs@5.0.1', 'rxjs': 'npm:rxjs@5.0.1',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js', 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js', 'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.0.10/lib/typescript.js', 'typescript': 'npm:typescript@2.2.1/lib/typescript.js',
}, },
// packages tells the System loader how to load when no filename and/or no extension // packages tells the System loader how to load when no filename and/or no extension

View File

@ -1,5 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HeroTeamBuilderComponent } from './hero-team-builder.component'; import { HeroTeamBuilderComponent } from './hero-team-builder.component';
import { HeroListBasicComponent } from './hero-list-basic.component'; import { HeroListBasicComponent } from './hero-list-basic.component';
@ -14,7 +15,7 @@ import { HeroListMultistepComponent } from './hero-list-multistep.component';
import { HeroListTimingsComponent } from './hero-list-timings.component'; import { HeroListTimingsComponent } from './hero-list-timings.component';
@NgModule({ @NgModule({
imports: [ BrowserModule ], imports: [ BrowserModule, BrowserAnimationsModule ],
declarations: [ declarations: [
HeroTeamBuilderComponent, HeroTeamBuilderComponent,
HeroListBasicComponent, HeroListBasicComponent,

View File

@ -1,12 +1,14 @@
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
animate, animate,
transition transition
} from '@angular/core'; } from '@angular/animations';
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -3,13 +3,15 @@
// #docregion imports // #docregion imports
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
transition, animate,
animate transition
} from '@angular/core'; } from '@angular/animations';
// #enddocregion imports // #enddocregion imports
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -2,13 +2,15 @@
// #docregion imports // #docregion imports
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
transition, animate,
animate transition
} from '@angular/core'; } from '@angular/animations';
// #enddocregion imports // #enddocregion imports
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -1,12 +1,14 @@
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
animate, animate,
transition transition
} from '@angular/core'; } from '@angular/animations';
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -1,12 +1,14 @@
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
animate, animate,
transition transition
} from '@angular/core'; } from '@angular/animations';
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -1,13 +1,15 @@
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
animate, animate,
transition, transition,
group group
} from '@angular/core'; } from '@angular/animations';
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -3,11 +3,13 @@
import { import {
Component, Component,
Input, Input,
} from '@angular/core';
import {
trigger, trigger,
style, style,
transition, animate,
animate transition
} from '@angular/core'; } from '@angular/animations';
// #enddocregion imports // #enddocregion imports
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -1,14 +1,16 @@
import { import {
Component, Component,
Input, Input,
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
animate, animate,
transition, transition,
keyframes, keyframes,
AnimationTransitionEvent AnimationEvent
} from '@angular/core'; } from '@angular/animations';
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';
@ -59,11 +61,11 @@ import { Heroes } from './hero.service';
export class HeroListMultistepComponent { export class HeroListMultistepComponent {
@Input() heroes: Heroes; @Input() heroes: Heroes;
animationStarted(event: AnimationTransitionEvent) { animationStarted(event: AnimationEvent) {
console.warn('Animation started: ', event); console.warn('Animation started: ', event);
} }
animationDone(event: AnimationTransitionEvent) { animationDone(event: AnimationEvent) {
console.warn('Animation done: ', event); console.warn('Animation done: ', event);
} }
} }

View File

@ -1,12 +1,14 @@
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
animate, animate,
transition transition
} from '@angular/core'; } from '@angular/animations';
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -2,13 +2,15 @@
// #docregion imports // #docregion imports
import { import {
Component, Component,
Input, Input
} from '@angular/core';
import {
trigger, trigger,
state, state,
style, style,
transition, animate,
animate transition
} from '@angular/core'; } from '@angular/animations';
// #enddocregion imports // #enddocregion imports
import { Heroes } from './hero.service'; import { Heroes } from './hero.service';

View File

@ -9,7 +9,7 @@ describe('AOT Compilation', function () {
browser.get(''); browser.get('');
}); });
it('should load page and click button', function (done) { it('should load page and click button', function (done: any) {
let headingSelector = element.all(by.css('h1')).get(0); let headingSelector = element.all(by.css('h1')).get(0);
expect(headingSelector.getText()).toEqual('Hello Angular'); expect(headingSelector.getText()).toEqual('Hello Angular');

View File

@ -0,0 +1,3 @@
{
"build": "build:babel"
}

View File

@ -163,7 +163,7 @@ describe('Dependency Injection Tests', function () {
describe('after button click', function() { describe('after button click', function() {
beforeAll(function (done) { beforeAll(function (done: any) {
let buttonEle = element.all(by.cssContainingText('button', 'Next User')).get(0); let buttonEle = element.all(by.cssContainingText('button', 'Next User')).get(0);
buttonEle.click().then(done, done); buttonEle.click().then(done, done);
}); });

View File

@ -1,6 +1,6 @@
// #docplaster // #docplaster
// #docregion // #docregion
import { Component, Injector } from '@angular/core'; import { Component, Injector, OnInit } from '@angular/core';
import { Car, Engine, Tires } from './car/car'; import { Car, Engine, Tires } from './car/car';
import { Hero } from './heroes/hero'; import { Hero } from './heroes/hero';
@ -19,16 +19,22 @@ import { Logger } from './logger.service';
`, `,
providers: [Car, Engine, Tires, heroServiceProvider, Logger] providers: [Car, Engine, Tires, heroServiceProvider, Logger]
}) })
export class InjectorComponent { export class InjectorComponent implements OnInit {
car: Car = this.injector.get(Car); car: Car;
// #docregion get-hero-service // #docregion get-hero-service
heroService: HeroService = this.injector.get(HeroService); heroService: HeroService;
// #enddocregion get-hero-service // #enddocregion get-hero-service
hero: Hero = this.heroService.getHeroes()[0]; hero: Hero;
constructor(private injector: Injector) { } constructor(private injector: Injector) { }
ngOnInit() {
this.car = this.injector.get(Car);
this.heroService = this.injector.get(HeroService);
this.hero = this.heroService.getHeroes()[0];
}
get rodent() { get rodent() {
let rousDontExist = `R.O.U.S.'s? I don't think they exist!`; let rousDontExist = `R.O.U.S.'s? I don't think they exist!`;
return this.injector.get(ROUS, rousDontExist); return this.injector.get(ROUS, rousDontExist);

View File

@ -16,7 +16,7 @@
<script src="https://unpkg.com/core-js/client/shim.min.js"></script> <script src="https://unpkg.com/core-js/client/shim.min.js"></script>
<!-- Update these package versions as needed --> <!-- Update these package versions as needed -->
<script src="https://unpkg.com/zone.js@0.7.4?main=browser"></script> <script src="https://unpkg.com/zone.js@0.8.4?main=browser"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script> <script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<!-- #enddocregion node-module-scripts --> <!-- #enddocregion node-module-scripts -->

View File

@ -0,0 +1,3 @@
{
"build": "build:babel"
}

View File

@ -24,9 +24,9 @@
<script src="node_modules/@angular/core/bundles/core.umd.js"></script> <script src="node_modules/@angular/core/bundles/core.umd.js"></script>
<script src="node_modules/@angular/common/bundles/common.umd.js"></script> <script src="node_modules/@angular/common/bundles/common.umd.js"></script>
<script src="node_modules/@angular/compiler/bundles/compiler.umd.js"></script> <script src="node_modules/@angular/compiler/bundles/compiler.umd.js"></script>
<script src="node_modules/@angular/forms/bundles/forms.umd.js"></script>
<script src="node_modules/@angular/platform-browser/bundles/platform-browser.umd.js"></script> <script src="node_modules/@angular/platform-browser/bundles/platform-browser.umd.js"></script>
<script src="node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js"></script> <script src="node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js"></script>
<script src="node_modules/@angular/forms/bundles/forms.umd.js"></script>
<!-- #docregion scripts-hero, scripts-hero-form --> <!-- #docregion scripts-hero, scripts-hero-form -->
<script src='app/hero.js'></script> <script src='app/hero.js'></script>

View File

@ -12,9 +12,9 @@
<!-- Polyfills --> <!-- Polyfills -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script> <script src="https://unpkg.com/core-js/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.4"></script> <script src="https://unpkg.com/zone.js@0.8.4"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script> <script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="https://unpkg.com/typescript@2.0.10/lib/typescript.js"></script> <script src="https://unpkg.com/typescript@2.2.1/lib/typescript.js"></script>
<!-- 2. Configure SystemJS --> <!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script> <script src="systemjs.config.js"></script>

View File

@ -13,9 +13,9 @@
<!-- Polyfills --> <!-- Polyfills -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script> <script src="https://unpkg.com/core-js/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.4"></script> <script src="https://unpkg.com/zone.js@0.8.4"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script> <script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="https://unpkg.com/typescript@2.0.10/lib/typescript.js"></script> <script src="https://unpkg.com/typescript@2.2.1/lib/typescript.js"></script>
<!-- 2. Configure SystemJS --> <!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script> <script src="systemjs.config.js"></script>

View File

@ -13,9 +13,9 @@
<!-- Polyfills --> <!-- Polyfills -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script> <script src="https://unpkg.com/core-js/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.4"></script> <script src="https://unpkg.com/zone.js@0.8.4"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script> <script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
<script src="https://unpkg.com/typescript@2.0.10/lib/typescript.js"></script> <script src="https://unpkg.com/typescript@2.2.1/lib/typescript.js"></script>
<!-- 2. Configure SystemJS --> <!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script> <script src="systemjs.config.js"></script>

View File

@ -12,26 +12,27 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@angular/common": "2.4.5", "@angular/animations": "~4.0.0",
"@angular/compiler": "2.4.5", "@angular/common": "~4.0.0",
"@angular/compiler-cli": "2.4.5", "@angular/compiler": "~4.0.0",
"@angular/core": "2.4.5", "@angular/compiler-cli": "~4.0.0",
"@angular/forms": "2.4.5", "@angular/core": "~4.0.0",
"@angular/http": "2.4.5", "@angular/forms": "~4.0.0",
"@angular/platform-browser": "2.4.5", "@angular/http": "~4.0.0",
"@angular/platform-browser-dynamic": "2.4.5", "@angular/platform-browser": "~4.0.0",
"@angular/platform-server": "2.4.5", "@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "3.4.5", "@angular/platform-server": "~4.0.0",
"@angular/tsc-wrapped": "^0.5.0", "@angular/router": "~4.0.0",
"@angular/upgrade": "2.4.5", "@angular/tsc-wrapped": "~4.0.0",
"angular-in-memory-web-api": "~0.2.4", "@angular/upgrade": "~4.0.0",
"angular-in-memory-web-api": "~0.3.1",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"rxjs": "5.0.1", "rxjs": "5.0.1",
"systemjs": "0.19.39", "systemjs": "0.19.39",
"zone.js": "^0.7.4" "zone.js": "^0.8.4"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "^1.0.0-rc.0", "@angular/cli": "^1.0.0-rc.4",
"@types/angular": "^1.5.16", "@types/angular": "^1.5.16",
"@types/angular-animate": "^1.5.5", "@types/angular-animate": "^1.5.5",
"@types/angular-cookies": "^1.4.2", "@types/angular-cookies": "^1.4.2",
@ -79,7 +80,7 @@
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"ts-node": "^1.3.0", "ts-node": "^1.3.0",
"tslint": "^3.15.1", "tslint": "^3.15.1",
"typescript": "~2.0.10", "typescript": "~2.2.0",
"webpack": "2.2.1", "webpack": "2.2.1",
"webpack-dev-server": "2.4.1", "webpack-dev-server": "2.4.1",
"webpack-merge": "^3.0.0" "webpack-merge": "^3.0.0"

View File

@ -0,0 +1,3 @@
{
"build": "build:babel"
}

View File

@ -17,10 +17,10 @@
"@angular/router": "~3.4.0", "@angular/router": "~3.4.0",
"@angular/upgrade": "~2.4.0", "@angular/upgrade": "~2.4.0",
"angular-in-memory-web-api": "~0.2.4", "angular-in-memory-web-api": "~0.3.1",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"rxjs": "5.0.1", "rxjs": "5.0.1",
"zone.js": "^0.7.4" "zone.js": "^0.8.4"
}, },
"devDependencies": { "devDependencies": {
"concurrently": "^3.0.0", "concurrently": "^3.0.0",

View File

@ -5,6 +5,7 @@ import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
// #docregion inspect-config // #docregion inspect-config
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
// #enddocregion inspect-config // #enddocregion inspect-config
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -24,7 +25,8 @@ import { DialogService } from './dialog.service';
FormsModule, FormsModule,
HeroesModule, HeroesModule,
LoginRoutingModule, LoginRoutingModule,
AppRoutingModule AppRoutingModule,
BrowserAnimationsModule
], ],
declarations: [ declarations: [
AppComponent, AppComponent,

View File

@ -56,19 +56,19 @@ describe('Server Communication', function () {
}); });
describe('Fetches after each keystroke', function () { describe('Fetches after each keystroke', function () {
it('should fetch results after "B"', function(done) { it('should fetch results after "B"', function(done: any) {
testForRefreshedResult('B', done); testForRefreshedResult('B', done);
}); });
it('should fetch results after "Ba"', function(done) { it('should fetch results after "Ba"', function(done: any) {
testForRefreshedResult('a', done); testForRefreshedResult('a', done);
}); });
it('should fetch results after "Bas"', function(done) { it('should fetch results after "Bas"', function(done: any) {
testForRefreshedResult('s', done); testForRefreshedResult('s', done);
}); });
it('should fetch results after "Basic"', function(done) { it('should fetch results after "Basic"', function(done: any) {
testForRefreshedResult('ic', done); testForRefreshedResult('ic', done);
}); });
}); });
@ -87,19 +87,19 @@ describe('Server Communication', function () {
expect(resultList.count()).toBe(0, 'result list must be empty'); expect(resultList.count()).toBe(0, 'result list must be empty');
}); });
it('should fetch results after "Java"', function(done) { it('should fetch results after "Java"', function(done: any) {
testForNewResult('Java', done); testForNewResult('Java', done);
}); });
it('should fetch results after "JavaS"', function(done) { it('should fetch results after "JavaS"', function(done: any) {
testForStaleResult('S', done); testForStaleResult('S', done);
}); });
it('should fetch results after "JavaSc"', function(done) { it('should fetch results after "JavaSc"', function(done: any) {
testForStaleResult('c', done); testForStaleResult('c', done);
}); });
it('should fetch results after "JavaScript"', function(done) { it('should fetch results after "JavaScript"', function(done: any) {
testForStaleResult('ript', done); testForStaleResult('ript', done);
}); });

View File

@ -0,0 +1,3 @@
{
"build": "build:babel"
}

View File

@ -9,17 +9,17 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@angular/common": "~2.4.0", "@angular/common": "~4.0.0",
"@angular/compiler": "~2.4.0", "@angular/compiler": "~4.0.0",
"@angular/core": "~2.4.0", "@angular/core": "~4.0.0",
"@angular/forms": "~2.4.0", "@angular/forms": "~4.0.0",
"@angular/http": "~2.4.0", "@angular/http": "~4.0.0",
"@angular/platform-browser": "~2.4.0", "@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~2.4.0", "@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~3.4.0", "@angular/router": "~4.0.0",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"rxjs": "5.0.1", "rxjs": "5.0.1",
"zone.js": "^0.7.4" "zone.js": "^0.8.4"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^6.0.45", "@types/node": "^6.0.45",

View File

@ -4,7 +4,7 @@
"title": "Angular Docs", "title": "Angular Docs",
"subtitle": "JavaScript", "subtitle": "JavaScript",
"menuTitle": "Docs Home", "menuTitle": "Docs Home",
"banner": "The latest Angular release is <b>2.4</b>. View the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank'>change log</a> to see enhancements, fixes, and breaking changes." "banner": "The latest Angular release is <b>4.0</b>. Learn about the latest <a href='guide/change-log.html' title='Documentation change log'>updates to the documentation</a>. View the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank' title='Angular Product Changes'>Angular change log</a> for enhancements, fixes, and breaking changes in Angular itself. If youre looking for Angular v2 documents, youll find them at <a href='https://v2.angular.io' title='Angular v2 docs archive'>v2.angular.io</a>."
}, },
"quickstart": { "quickstart": {

View File

@ -1,4 +0,0 @@
- var base = current.path[4] ? '.' : './guide';
.l-content-small.grid-fluid.docs-content.cheatsheet
ngio-cheatsheet(src= base + '/cheatsheet.json')

View File

@ -1 +1 @@
extends ../cheatsheet extends ../../../ts/latest/guide/cheatsheet

View File

@ -4,7 +4,7 @@
"title": "Angular Docs", "title": "Angular Docs",
"subtitle": "TypeScript", "subtitle": "TypeScript",
"menuTitle": "Docs Home", "menuTitle": "Docs Home",
"banner": "The latest Angular release is <b>2.4</b>. Learn about the latest <a href='guide/change-log.html' title='Documentation change log'>updates to the documentation</a>. View the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank' title='Angular Product Changes'>Angular change log</a> for enhancements, fixes, and breaking changes in Angular itself." "banner": "The latest Angular release is <b>4.0</b>. Learn about the latest <a href='guide/change-log.html' title='Documentation change log'>updates to the documentation</a>. View the <a href='https://github.com/angular/angular/blob/master/CHANGELOG.md' target='_blank' title='Angular Product Changes'>Angular change log</a> for enhancements, fixes, and breaking changes in Angular itself. If youre looking for Angular v2 documents, youll find them at <a href='https://v2.angular.io' title='Angular v2 docs archive'>v2.angular.io</a>."
}, },
"quickstart": { "quickstart": {

View File

@ -1,4 +0,0 @@
- var base = current.path[4] ? '.' : './guide';
.l-content-small.grid-fluid.docs-content.cheatsheet
ngio-cheatsheet(src= base + '/cheatsheet.json')

View File

@ -5,6 +5,8 @@ block includes
The Angular documentation is a living document with continuous improvements. The Angular documentation is a living document with continuous improvements.
This log calls attention to recent significant changes. This log calls attention to recent significant changes.
## Updated to Angular 4.0. Documentation for Angular 2.x can be found at [v2.angular.io](https://v2.angular.io).
## All mention of moduleId removed. "Component relative paths" cookbook deleted (2017-03-13) ## All mention of moduleId removed. "Component relative paths" cookbook deleted (2017-03-13)
We added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration. We added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.
This plugin dynamically converts "component-relative" paths in templateUrl and styleUrls to "absolute paths" for you. This plugin dynamically converts "component-relative" paths in templateUrl and styleUrls to "absolute paths" for you.

View File

@ -1 +1,391 @@
extends ../cheatsheet // SCSS from
// resources/css/module/_cheatsheet.scss
// resources/css/layout/_grids.scss: grid-fluid
// resources/css/layout/_layout.scss: docs-content, l-content-small
<div class="l-content-small grid-fluid docs-content cheatsheet">
<table>
<tbody><tr>
<th>Bootstrapping</th>
<th><p><code>import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';</code>
</p>
</th>
</tr>
<tr>
<td><code><b>platformBrowserDynamic().bootstrapModule</b>(AppModule);</code></td>
<td><p>Bootstraps the app, using the root component from the specified <code>NgModule</code>. </p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>NgModules</th>
<th><p><code>import { NgModule } from '@angular/core';</code>
</p>
</th>
</tr>
<tr>
<td><code>@<b>NgModule</b>({&nbsp;declarations:&nbsp;...,&nbsp;imports:&nbsp;...,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exports:&nbsp;...,&nbsp;providers:&nbsp;...,&nbsp;bootstrap:&nbsp;...})<br>class&nbsp;MyModule&nbsp;{}</code></td>
<td><p>Defines a module that contains components, directives, pipes, and providers.</p>
</td>
</tr><tr>
<td><code><b>declarations:</b>&nbsp;[MyRedComponent,&nbsp;MyBlueComponent,&nbsp;MyDatePipe]</code></td>
<td><p>List of components, directives, and pipes that belong to this module.</p>
</td>
</tr><tr>
<td><code><b>imports:</b>&nbsp;[BrowserModule,&nbsp;SomeOtherModule]</code></td>
<td><p>List of modules to import into this module. Everything from the imported modules
is available to <code>declarations</code> of this module.</p>
</td>
</tr><tr>
<td><code><b>exports:</b>&nbsp;[MyRedComponent,&nbsp;MyDatePipe]</code></td>
<td><p>List of components, directives, and pipes visible to modules that import this module.</p>
</td>
</tr><tr>
<td><code><b>providers:</b>&nbsp;[MyService,&nbsp;{&nbsp;provide:&nbsp;...&nbsp;}]</code></td>
<td><p>List of dependency injection providers visible both to the contents of this module and to importers of this module.</p>
</td>
</tr><tr>
<td><code><b>bootstrap:</b>&nbsp;[MyAppComponent]</code></td>
<td><p>List of components to bootstrap when this module is bootstrapped.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Template syntax</th>
<th></th>
</tr>
<tr>
<td><code>&lt;input&nbsp;<b>[value]</b>="firstName"&gt;</code></td>
<td><p>Binds property <code>value</code> to the result of expression <code>firstName</code>.</p>
</td>
</tr><tr>
<td><code>&lt;div&nbsp;<b>[attr.role]</b>="myAriaRole"&gt;</code></td>
<td><p>Binds attribute <code>role</code> to the result of expression <code>myAriaRole</code>.</p>
</td>
</tr><tr>
<td><code>&lt;div&nbsp;<b>[class.extra-sparkle]</b>="isDelightful"&gt;</code></td>
<td><p>Binds the presence of the CSS class <code>extra-sparkle</code> on the element to the truthiness of the expression <code>isDelightful</code>.</p>
</td>
</tr><tr>
<td><code>&lt;div&nbsp;<b>[style.width.px]</b>="mySize"&gt;</code></td>
<td><p>Binds style property <code>width</code> to the result of expression <code>mySize</code> in pixels. Units are optional.</p>
</td>
</tr><tr>
<td><code>&lt;button&nbsp;<b>(click)</b>="readRainbow($event)"&gt;</code></td>
<td><p>Calls method <code>readRainbow</code> when a click event is triggered on this button element (or its children) and passes in the event object.</p>
</td>
</tr><tr>
<td><code>&lt;div&nbsp;title="Hello&nbsp;<b>{{ponyName}}</b>"&gt;</code></td>
<td><p>Binds a property to an interpolated string, for example, "Hello Seabiscuit". Equivalent to:
<code>&lt;div [title]="'Hello ' + ponyName"&gt;</code></p>
</td>
</tr><tr>
<td><code>&lt;p&gt;Hello&nbsp;<b>{{ponyName}}</b>&lt;/p&gt;</code></td>
<td><p>Binds text content to an interpolated string, for example, "Hello Seabiscuit".</p>
</td>
</tr><tr>
<td><code>&lt;my-cmp&nbsp;<b>[(title)]</b>="name"&gt;</code></td>
<td><p>Sets up two-way data binding. Equivalent to: <code>&lt;my-cmp [title]="name" (titleChange)="name=$event"&gt;</code></p>
</td>
</tr><tr>
<td><code>&lt;video&nbsp;<b>#movieplayer</b>&nbsp;...&gt;<br>&nbsp;&nbsp;&lt;button&nbsp;<b>(click)</b>="movieplayer.play()"&gt;<br>&lt;/video&gt;</code></td>
<td><p>Creates a local variable <code>movieplayer</code> that provides access to the <code>video</code> element instance in data-binding and event-binding expressions in the current template.</p>
</td>
</tr><tr>
<td><code>&lt;p&nbsp;<b>*myUnless</b>="myExpression"&gt;...&lt;/p&gt;</code></td>
<td><p>The <code>*</code> symbol turns the current element into an embedded template. Equivalent to:
<code>&lt;template [myUnless]="myExpression"&gt;&lt;p&gt;...&lt;/p&gt;&lt;/template&gt;</code></p>
</td>
</tr><tr>
<td><code>&lt;p&gt;Card&nbsp;No.:&nbsp;<b>{{cardNumber&nbsp;|&nbsp;myCardNumberFormatter}}</b>&lt;/p&gt;</code></td>
<td><p>Transforms the current value of expression <code>cardNumber</code> via the pipe called <code>myCardNumberFormatter</code>.</p>
</td>
</tr><tr>
<td><code>&lt;p&gt;Employer:&nbsp;<b>{{employer?.companyName}}</b>&lt;/p&gt;</code></td>
<td><p>The safe navigation operator (<code>?</code>) means that the <code>employer</code> field is optional and if <code>undefined</code>, the rest of the expression should be ignored.</p>
</td>
</tr><tr>
<td><code>&lt;<b>svg:</b>rect&nbsp;x="0"&nbsp;y="0"&nbsp;width="100"&nbsp;height="100"/&gt;</code></td>
<td><p>An SVG snippet template needs an <code>svg:</code> prefix on its root element to disambiguate the SVG element from an HTML component.</p>
</td>
</tr><tr>
<td><code>&lt;<b>svg</b>&gt;<br>&nbsp;&nbsp;&lt;rect&nbsp;x="0"&nbsp;y="0"&nbsp;width="100"&nbsp;height="100"/&gt;<br>&lt;/<b>svg</b>&gt;</code></td>
<td><p>An <code>&lt;svg&gt;</code> root element is detected as an SVG element automatically, without the prefix.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Built-in directives</th>
<th><p><code>import { CommonModule } from '@angular/common';</code>
</p>
</th>
</tr>
<tr>
<td><code>&lt;section&nbsp;<b>*ngIf</b>="showSection"&gt;</code></td>
<td><p>Removes or recreates a portion of the DOM tree based on the <code>showSection</code> expression.</p>
</td>
</tr><tr>
<td><code>&lt;li&nbsp;<b>*ngFor</b>="let&nbsp;item&nbsp;of&nbsp;list"&gt;</code></td>
<td><p>Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.</p>
</td>
</tr><tr>
<td><code>&lt;div&nbsp;<b>[ngSwitch]</b>="conditionExpression"&gt;<br>&nbsp;&nbsp;&lt;template&nbsp;<b>[<b>ngSwitchCase</b>]</b>="case1Exp"&gt;...&lt;/template&gt;<br>&nbsp;&nbsp;&lt;template&nbsp;<b>ngSwitchCase</b>="case2LiteralString"&gt;...&lt;/template&gt;<br>&nbsp;&nbsp;&lt;template&nbsp;<b>ngSwitchDefault</b>&gt;...&lt;/template&gt;<br>&lt;/div&gt;</code></td>
<td><p>Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of <code>conditionExpression</code>.</p>
</td>
</tr><tr>
<td><code>&lt;div&nbsp;<b>[ngClass]</b>="{active:&nbsp;isActive,&nbsp;disabled:&nbsp;isDisabled}"&gt;</code></td>
<td><p>Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Forms</th>
<th><p><code>import { FormsModule } from '@angular/forms';</code>
</p>
</th>
</tr>
<tr>
<td><code>&lt;input&nbsp;<b>[(ngModel)]</b>="userName"&gt;</code></td>
<td><p>Provides two-way data-binding, parsing, and validation for form controls.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Class decorators</th>
<th><p><code>import { Directive, ... } from '@angular/core';</code>
</p>
</th>
</tr>
<tr>
<td><code><b>@Component({...})</b><br>class&nbsp;MyComponent()&nbsp;{}</code></td>
<td><p>Declares that a class is a component and provides metadata about the component.</p>
</td>
</tr><tr>
<td><code><b>@Directive({...})</b><br>class&nbsp;MyDirective()&nbsp;{}</code></td>
<td><p>Declares that a class is a directive and provides metadata about the directive.</p>
</td>
</tr><tr>
<td><code><b>@Pipe({...})</b><br>class&nbsp;MyPipe()&nbsp;{}</code></td>
<td><p>Declares that a class is a pipe and provides metadata about the pipe.</p>
</td>
</tr><tr>
<td><code><b>@Injectable()</b><br>class&nbsp;MyService()&nbsp;{}</code></td>
<td><p>Declares that a class has dependencies that should be injected into the constructor when the dependency injector is creating an instance of this class.
</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Directive configuration</th>
<th><p><code>@Directive({ property1: value1, ... })</code>
</p>
</th>
</tr>
<tr>
<td><code><b>selector:</b>&nbsp;'.cool-button:not(a)'</code></td>
<td><p>Specifies a CSS selector that identifies this directive within a template. Supported selectors include <code>element</code>,
<code>[attribute]</code>, <code>.class</code>, and <code>:not()</code>.</p>
<p>Does not support parent-child relationship selectors.</p>
</td>
</tr><tr>
<td><code><b>providers:</b>&nbsp;[MyService,&nbsp;{&nbsp;provide:&nbsp;...&nbsp;}]</code></td>
<td><p>List of dependency injection providers for this directive and its children.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Component configuration</th>
<th><p>
<code>@Component</code> extends <code>@Directive</code>,
so the <code>@Directive</code> configuration applies to components as well</p>
</th>
</tr>
<tr>
<td><code><b>moduleId:</b>&nbsp;module.id</code></td>
<td><p>If set, the <code>templateUrl</code> and <code>styleUrl</code> are resolved relative to the component.</p>
</td>
</tr><tr>
<td><code><b>viewProviders:</b>&nbsp;[MyService,&nbsp;{&nbsp;provide:&nbsp;...&nbsp;}]</code></td>
<td><p>List of dependency injection providers scoped to this component's view.</p>
</td>
</tr><tr>
<td><code><b>template:</b>&nbsp;'Hello&nbsp;{{name}}'<br><b>templateUrl:</b>&nbsp;'my-component.html'</code></td>
<td><p>Inline template or external template URL of the component's view.</p>
</td>
</tr><tr>
<td><code><b>styles:</b>&nbsp;['.primary&nbsp;{color:&nbsp;red}']<br><b>styleUrls:</b>&nbsp;['my-component.css']</code></td>
<td><p>List of inline CSS styles or external stylesheet URLs for styling the components view.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Class field decorators for directives and components</th>
<th><p><code>import { Input, ... } from '@angular/core';</code>
</p>
</th>
</tr>
<tr>
<td><code><b>@Input()</b>&nbsp;myProperty;</code></td>
<td><p>Declares an input property that you can update via property binding (example:
<code>&lt;my-cmp [myProperty]="someExpression"&gt;</code>).</p>
</td>
</tr><tr>
<td><code><b>@Output()</b>&nbsp;myEvent&nbsp;=&nbsp;new&nbsp;EventEmitter();</code></td>
<td><p>Declares an output property that fires events that you can subscribe to with an event binding (example: <code>&lt;my-cmp (myEvent)="doSomething()"&gt;</code>).</p>
</td>
</tr><tr>
<td><code><b>@HostBinding('class.valid')</b>&nbsp;isValid;</code></td>
<td><p>Binds a host element property (here, the CSS class <code>valid</code>) to a directive/component property (<code>isValid</code>).</p>
</td>
</tr><tr>
<td><code><b>@HostListener('click',&nbsp;['$event'])</b>&nbsp;onClick(e)&nbsp;{...}</code></td>
<td><p>Subscribes to a host element event (<code>click</code>) with a directive/component method (<code>onClick</code>), optionally passing an argument (<code>$event</code>).</p>
</td>
</tr><tr>
<td><code><b>@ContentChild(myPredicate)</b>&nbsp;myChildComponent;</code></td>
<td><p>Binds the first result of the component content query (<code>myPredicate</code>) to a property (<code>myChildComponent</code>) of the class.</p>
</td>
</tr><tr>
<td><code><b>@ContentChildren(myPredicate)</b>&nbsp;myChildComponents;</code></td>
<td><p>Binds the results of the component content query (<code>myPredicate</code>) to a property (<code>myChildComponents</code>) of the class.</p>
</td>
</tr><tr>
<td><code><b>@ViewChild(myPredicate)</b>&nbsp;myChildComponent;</code></td>
<td><p>Binds the first result of the component view query (<code>myPredicate</code>) to a property (<code>myChildComponent</code>) of the class. Not available for directives.</p>
</td>
</tr><tr>
<td><code><b>@ViewChildren(myPredicate)</b>&nbsp;myChildComponents;</code></td>
<td><p>Binds the results of the component view query (<code>myPredicate</code>) to a property (<code>myChildComponents</code>) of the class. Not available for directives.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Directive and component change detection and lifecycle hooks</th>
<th><p>(implemented as class methods)
</p>
</th>
</tr>
<tr>
<td><code><b>constructor(myService:&nbsp;MyService,&nbsp;...)</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.</p>
</td>
</tr><tr>
<td><code><b>ngOnChanges(changeRecord)</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called after every change to input properties and before processing content or child views.</p>
</td>
</tr><tr>
<td><code><b>ngOnInit()</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called after the constructor, initializing input properties, and the first call to <code>ngOnChanges</code>.</p>
</td>
</tr><tr>
<td><code><b>ngDoCheck()</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.</p>
</td>
</tr><tr>
<td><code><b>ngAfterContentInit()</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called after <code>ngOnInit</code> when the component's or directive's content has been initialized.</p>
</td>
</tr><tr>
<td><code><b>ngAfterContentChecked()</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called after every check of the component's or directive's content.</p>
</td>
</tr><tr>
<td><code><b>ngAfterViewInit()</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called after <code>ngAfterContentInit</code> when the component's view has been initialized. Applies to components only.</p>
</td>
</tr><tr>
<td><code><b>ngAfterViewChecked()</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called after every check of the component's view. Applies to components only.</p>
</td>
</tr><tr>
<td><code><b>ngOnDestroy()</b>&nbsp;{&nbsp;...&nbsp;}</code></td>
<td><p>Called once, before the instance is destroyed.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Dependency injection configuration</th>
<th></th>
</tr>
<tr>
<td><code>{&nbsp;<b>provide</b>:&nbsp;MyService,&nbsp;<b>useClass</b>:&nbsp;MyMockService&nbsp;}</code></td>
<td><p>Sets or overrides the provider for <code>MyService</code> to the <code>MyMockService</code> class.</p>
</td>
</tr><tr>
<td><code>{&nbsp;<b>provide</b>:&nbsp;MyService,&nbsp;<b>useFactory</b>:&nbsp;myFactory&nbsp;}</code></td>
<td><p>Sets or overrides the provider for <code>MyService</code> to the <code>myFactory</code> factory function.</p>
</td>
</tr><tr>
<td><code>{&nbsp;<b>provide</b>:&nbsp;MyValue,&nbsp;<b>useValue</b>:&nbsp;41&nbsp;}</code></td>
<td><p>Sets or overrides the provider for <code>MyValue</code> to the value <code>41</code>.</p>
</td>
</tr>
</tbody></table>
<table>
<tbody><tr>
<th>Routing and navigation</th>
<th><p><code>import { Routes, RouterModule, ... } from '@angular/router';</code>
</p>
</th>
</tr>
<tr>
<td><code>const&nbsp;routes:&nbsp;<b>Routes</b>&nbsp;=&nbsp;[<br>&nbsp;&nbsp;{&nbsp;path:&nbsp;'',&nbsp;component:&nbsp;HomeComponent&nbsp;},<br>&nbsp;&nbsp;{&nbsp;path:&nbsp;'path/:routeParam',&nbsp;component:&nbsp;MyComponent&nbsp;},<br>&nbsp;&nbsp;{&nbsp;path:&nbsp;'staticPath',&nbsp;component:&nbsp;...&nbsp;},<br>&nbsp;&nbsp;{&nbsp;path:&nbsp;'**',&nbsp;component:&nbsp;...&nbsp;},<br>&nbsp;&nbsp;{&nbsp;path:&nbsp;'oldPath',&nbsp;redirectTo:&nbsp;'/staticPath'&nbsp;},<br>&nbsp;&nbsp;{&nbsp;path:&nbsp;...,&nbsp;component:&nbsp;...,&nbsp;data:&nbsp;{&nbsp;message:&nbsp;'Custom'&nbsp;}&nbsp;}<br>]);<br><br>const&nbsp;routing&nbsp;=&nbsp;RouterModule.forRoot(routes);</code></td>
<td><p>Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.</p>
</td>
</tr><tr>
<td><code><br>&lt;<b>router-outlet</b>&gt;&lt;/<b>router-outlet</b>&gt;<br>&lt;<b>router-outlet</b>&nbsp;name="aux"&gt;&lt;/<b>router-outlet</b>&gt;<br></code></td>
<td><p>Marks the location to load the component of the active route.</p>
</td>
</tr><tr>
<td><code><br>&lt;a&nbsp;routerLink="/path"&gt;<br>&lt;a&nbsp;<b>[routerLink]</b>="[&nbsp;'/path',&nbsp;routeParam&nbsp;]"&gt;<br>&lt;a&nbsp;<b>[routerLink]</b>="[&nbsp;'/path',&nbsp;{&nbsp;matrixParam:&nbsp;'value'&nbsp;}&nbsp;]"&gt;<br>&lt;a&nbsp;<b>[routerLink]</b>="[&nbsp;'/path'&nbsp;]"&nbsp;[queryParams]="{&nbsp;page:&nbsp;1&nbsp;}"&gt;<br>&lt;a&nbsp;<b>[routerLink]</b>="[&nbsp;'/path'&nbsp;]"&nbsp;fragment="anchor"&gt;<br></code></td>
<td><p>Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the <code>/</code> prefix; for a child route, use the <code>./</code>prefix; for a sibling or parent, use the <code>../</code> prefix.</p>
</td>
</tr><tr>
<td><code>&lt;a&nbsp;[routerLink]="[&nbsp;'/path'&nbsp;]"&nbsp;routerLinkActive="active"&gt;</code></td>
<td><p>The provided classes are added to the element when the <code>routerLink</code> becomes the current active route.</p>
</td>
</tr><tr>
<td><code>class&nbsp;<b>CanActivate</b>Guard&nbsp;implements&nbsp;<b>CanActivate</b>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;canActivate(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route:&nbsp;ActivatedRouteSnapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state:&nbsp;RouterStateSnapshot<br>&nbsp;&nbsp;&nbsp;&nbsp;):&nbsp;Observable&lt;boolean&gt;|Promise&lt;boolean&gt;|boolean&nbsp;{&nbsp;...&nbsp;}<br>}<br><br>{&nbsp;path:&nbsp;...,&nbsp;canActivate:&nbsp;[<b>CanActivate</b>Guard]&nbsp;}</code></td>
<td><p>An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.</p>
</td>
</tr><tr>
<td><code>class&nbsp;<b>CanDeactivate</b>Guard&nbsp;implements&nbsp;<b>CanDeactivate</b>&lt;T&gt;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;canDeactivate(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;component:&nbsp;T,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route:&nbsp;ActivatedRouteSnapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state:&nbsp;RouterStateSnapshot<br>&nbsp;&nbsp;&nbsp;&nbsp;):&nbsp;Observable&lt;boolean&gt;|Promise&lt;boolean&gt;|boolean&nbsp;{&nbsp;...&nbsp;}<br>}<br><br>{&nbsp;path:&nbsp;...,&nbsp;canDeactivate:&nbsp;[<b>CanDeactivate</b>Guard]&nbsp;}</code></td>
<td><p>An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.</p>
</td>
</tr><tr>
<td><code>class&nbsp;<b>CanActivateChild</b>Guard&nbsp;implements&nbsp;<b>CanActivateChild</b>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;canActivateChild(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route:&nbsp;ActivatedRouteSnapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state:&nbsp;RouterStateSnapshot<br>&nbsp;&nbsp;&nbsp;&nbsp;):&nbsp;Observable&lt;boolean&gt;|Promise&lt;boolean&gt;|boolean&nbsp;{&nbsp;...&nbsp;}<br>}<br><br>{&nbsp;path:&nbsp;...,&nbsp;canActivateChild:&nbsp;[CanActivateGuard],<br>&nbsp;&nbsp;&nbsp;&nbsp;children:&nbsp;...&nbsp;}</code></td>
<td><p>An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.</p>
</td>
</tr><tr>
<td><code>class&nbsp;<b>Resolve</b>Guard&nbsp;implements&nbsp;<b>Resolve</b>&lt;T&gt;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;resolve(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route:&nbsp;ActivatedRouteSnapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state:&nbsp;RouterStateSnapshot<br>&nbsp;&nbsp;&nbsp;&nbsp;):&nbsp;Observable&lt;any&gt;|Promise&lt;any&gt;|any&nbsp;{&nbsp;...&nbsp;}<br>}<br><br>{&nbsp;path:&nbsp;...,&nbsp;resolve:&nbsp;[<b>Resolve</b>Guard]&nbsp;}</code></td>
<td><p>An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.</p>
</td>
</tr><tr>
<td><code>class&nbsp;<b>CanLoad</b>Guard&nbsp;implements&nbsp;<b>CanLoad</b>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;canLoad(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route:&nbsp;Route<br>&nbsp;&nbsp;&nbsp;&nbsp;):&nbsp;Observable&lt;boolean&gt;|Promise&lt;boolean&gt;|boolean&nbsp;{&nbsp;...&nbsp;}<br>}<br><br>{&nbsp;path:&nbsp;...,&nbsp;canLoad:&nbsp;[<b>CanLoad</b>Guard],&nbsp;loadChildren:&nbsp;...&nbsp;}</code></td>
<td><p>An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.</p>
</td>
</tr>
</tbody></table>
</div>

View File

@ -3,4 +3,8 @@
set -ex -o pipefail set -ex -o pipefail
./scripts/examples-install.sh ./scripts/examples-install.sh
(cd public/docs/_examples && npm install angular/{core,common,compiler,platform-browser,platform-browser-dynamic,http,forms,router,upgrade}-builds#$PREVIEW_BRANCH --no-optional) # For master branches (ng4) also install typescript@^2.1.5
if [[ "$PREVIEW_BRANCH" == "master" ]]; then
EXTRA_PACKAGES="typescript@^2.1.5"
fi
(cd public/docs/_examples && npm install angular/{animations,core,common,compiler,compiler-cli,platform-browser,platform-browser-dynamic,platform-server,http,forms,router,tsc-wrapped,upgrade}-builds#$PREVIEW_BRANCH $EXTRA_PACKAGES --no-optional)

View File

@ -44,29 +44,33 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
if (!fs.existsSync(angular_repo_path)) { if (!fs.existsSync(angular_repo_path)) {
throw new Error('build-api-docs task requires the angular repo to be at ' + angular_repo_path); throw new Error('build-api-docs task requires the angular repo to be at ' + angular_repo_path);
} }
readTypeScriptModules.basePath = path.resolve(angular_repo_path, 'modules'); readTypeScriptModules.basePath = path.resolve(angular_repo_path, 'packages');
readTypeScriptModules.ignoreExportsMatching = [/^_/]; readTypeScriptModules.ignoreExportsMatching = [/^(_|ɵ)/];
readTypeScriptModules.sourceFiles = [ readTypeScriptModules.sourceFiles = [
'@angular/common/index.ts', 'animations/index.ts',
'@angular/common/testing/index.ts', 'animations/browser/index.ts',
'@angular/core/index.ts', 'animations/browser/testing.ts',
'@angular/core/testing/index.ts', 'common/index.ts',
'@angular/forms/index.ts', 'common/testing/index.ts',
'@angular/http/index.ts', 'core/index.ts',
'@angular/http/testing/index.ts', 'core/testing/index.ts',
'@angular/platform-browser/index.ts', 'forms/index.ts',
'@angular/platform-browser/testing/index.ts', 'http/index.ts',
'@angular/platform-browser-dynamic/index.ts', 'http/testing/index.ts',
'@angular/platform-browser-dynamic/testing/index.ts', 'platform-browser/index.ts',
'@angular/platform-server/index.ts', 'platform-browser/animations/index.ts',
'@angular/platform-server/testing/index.ts', 'platform-browser/testing/index.ts',
'@angular/platform-webworker/index.ts', 'platform-browser-dynamic/index.ts',
'@angular/platform-webworker-dynamic/index.ts', 'platform-browser-dynamic/testing/index.ts',
'@angular/router/index.ts', 'platform-server/index.ts',
'@angular/router/testing/index.ts', 'platform-server/testing/index.ts',
'@angular/upgrade/index.ts', 'platform-webworker/index.ts',
'@angular/upgrade/static.ts' 'platform-webworker-dynamic/index.ts',
'router/index.ts',
'router/testing/index.ts',
'upgrade/index.ts',
'upgrade/static.ts'
]; ];
readTypeScriptModules.hidePrivateMembers = true; readTypeScriptModules.hidePrivateMembers = true;

View File

@ -138,7 +138,7 @@ function createShredExamplePackage(shredOptions) {
readFilesProcessor.sourceFiles = [ { readFilesProcessor.sourceFiles = [ {
// Process all candidate files in `src` and its subfolders ... // Process all candidate files in `src` and its subfolders ...
include: includeFiles , include: includeFiles ,
exclude: [ '**/node_modules/**', '**/dist/**', '**/packages/**', '**/dart/build/**'], exclude: [ '**/node_modules/**', '**/dist/**', '**/dart/build/**'],
// When calculating the relative path to these files use this as the base path. // When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js` // So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath: options.examplesDir basePath: options.examplesDir
@ -190,7 +190,7 @@ function createShredJadePackage(shredOptions) {
readFilesProcessor.sourceFiles = [ { readFilesProcessor.sourceFiles = [ {
// Process all candidate files in `src` and its subfolders ... // Process all candidate files in `src` and its subfolders ...
include: includeFiles , include: includeFiles ,
exclude: [ '**/node_modules/**', '**/packages/**', '**/dart/build/**', '**/_code-examples.jade'], exclude: [ '**/node_modules/**', '**/dart/build/**', '**/_code-examples.jade'],
// When calculating the relative path to these files use this as the base path. // When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js` // So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath: options.jadeDir basePath: options.jadeDir
@ -244,7 +244,7 @@ var createShredMapPackage = function(mapOptions) {
readFilesProcessor.sourceFiles = [ { readFilesProcessor.sourceFiles = [ {
// Process all candidate files in `src` and its subfolders ... // Process all candidate files in `src` and its subfolders ...
include: includeFiles, include: includeFiles,
exclude: ['**/node_modules/**', '**/packages/**', '**/dart/build/**'], exclude: ['**/node_modules/**', '**/dart/build/**'],
// When calculating the relative path to these files use this as the base path. // When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js` // So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath: options.jadeDir basePath: options.jadeDir

View File

@ -49,7 +49,7 @@ var rulesToApply = [
{ {
pattern: 'script', pattern: 'script',
from: 'node_modules/zone.js/dist/zone.js', from: 'node_modules/zone.js/dist/zone.js',
to: 'https://unpkg.com/zone.js@0.7.4?main=browser' to: 'https://unpkg.com/zone.js@0.8.4?main=browser'
}, },
{ {
pattern: 'script', pattern: 'script',