Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 17c7e15
Author: Filipe Silva <[email protected]>
Date:   Mon Nov 14 23:11:37 2016 +0000

    chore: update to 2.2.0 (#2797)

commit 1e5facf
Merge: 5c4cc9a db0fac9
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 12:44:51 2016 -0800

    Merge pull request #2799 from IdeaBlade/docs-changelog-2.2.0

    chore(changelog): update docs changelog for Ng v.2.2.0

commit 5c4cc9a
Merge: 43457e9 1afe5dc
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 12:43:09 2016 -0800

    docs(router): Updated usage of observables in router tutorial and developer guide (#2696)

    Moved route configuration into separate variable for consistency
    Added async pipe to handle subscriptions for list items

commit 43457e9
Merge: a423a5a 2649647
Author: Jesús Rodríguez <[email protected]>
Date:   Mon Nov 14 21:38:49 2016 +0100

    chore: add upgrade/static to API reference (#2755)

commit 1afe5dc
Author: Brandon Roberts <[email protected]>
Date:   Sat Oct 29 16:08:54 2016 -0500

    docs(router): Updated usage of observables in router tutorial and developer guide

    Moved route configuration into separate variable for consistency
    Added async pipe to handle subscriptions for list items

commit db0fac9
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 10:48:09 2016 -0800

    chore(changelog): update docs changelog for Ng v.2.2.0

commit a423a5a
Author: ikilled <[email protected]>
Date:   Mon Nov 14 18:39:46 2016 +0000

    clicking on Books & Training sends user to Education (#2701)

    When user clicks in Books & Training item in footer the website should take them to Education section (anchor) in the middle of the page, not to the top where Development section is.

commit d63b1cc
Merge: f627706 8508140
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 10:35:48 2016 -0800

    docs(router): fixed verbiage about router-outlet (#2746)

commit f627706
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 10:26:13 2016 -0800

    docs(cookbook-aot-compiler): improve Ahead-of-Time compilation cookbook (#2798)

    closes #2790

commit 75464d5
Merge: 78e2584 02f5559
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 09:34:36 2016 -0800

    Merge pull request #2794 from IdeaBlade/chalin-guide-misc-fix-1113

    docs: guide/index misc Jade fixes

commit 78e2584
Merge: 182493f 85062c4
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 09:33:55 2016 -0800

    Merge pull request #2795 from IdeaBlade/chalin-util-js-getExampleName-1114

    chore(util.js): getExampleName - support optional .html suffix

commit 182493f
Merge: 9e9666b 53f5538
Author: Ward Bell <[email protected]>
Date:   Mon Nov 14 09:28:40 2016 -0800

    feat(cb-ts-to-js): add es6 examples (#2606)

    * feat(cb-ts-to-js): add es6 examples
    update docshredder to shred .es6
    optimized focus gulp task
    convert imports and metadate sections
    add DI section
    add host and query metadata section
    add intro
    fix capitalization and grammar

    * docs(ts-to-js): ward's edits (incomplete)

    * docs(ts-to-js): add separate template files for some components

    * docs(cb-ts-to-js): refactor sample code

commit 53f5538
Author: Ward Bell <[email protected]>
Date:   Sun Nov 13 14:09:28 2016 -0800

    docs(cb-ts-to-js): refactor sample code

commit 9e9666b
Author: Patrice Chalin <[email protected]>
Date:   Mon Nov 14 08:34:10 2016 -0800

    docs(template-syntax/dart): updates to match TS (#2751)

    * docs(template-syntax): refresh _cache

    * docs(template-syntax/dart): updates to match TS

    - Propagates TS-side changes:
      - update #2639 - new two-way binding section, and
      - fix #2687 - invalid attr syntax
    - Fixes
      - #1898 - currency symbols
      - #2748 - Dart template-syntax e2e is failing
      - #2749 - deprecated `[className]`

    * updated _cache file following Kathy's post-review edits

    * Post Ward's review w/ cache updated

    - Keep `my-` and `my` prefixes on selectors (for components and
    directives, respectively).
    - Drop `my-` from file names.
    - Drop `My` as component class prefix.

commit 5dcffd6
Author: Patrice Chalin <[email protected]>
Date:   Sun Nov 13 19:37:13 2016 -0800

    docs: dart glossary - fix misnamed Jade block

commit 6680acc
Merge: 14db838 3b03573
Author: Kathy Walrath <[email protected]>
Date:   Mon Nov 14 08:31:11 2016 -0800

    docs(toh): avoid dup header title (#2796)

    * remove redundant headings

    * update _cache

    * misc: make block comment a Jade comment

    (This prevents the text from appearing in the generated HTML as an HTML
    comment.)

commit 3b03573
Author: Patrice Chalin <[email protected]>
Date:   Mon Nov 14 05:30:05 2016 -0800

    misc: make block comment a Jade comment

    (This prevents the text from appearing in the generated HTML as an HTML
    comment.)

commit 470426d
Author: Patrice Chalin <[email protected]>
Date:   Mon Nov 14 05:25:36 2016 -0800

    update _cache

commit c12d75a
Author: Patrice Chalin <[email protected]>
Date:   Mon Nov 14 05:23:35 2016 -0800

    remove redundant headings

commit 85062c4
Author: Patrice Chalin <[email protected]>
Date:   Mon Nov 14 04:56:12 2016 -0800

    chore(util.js): getExampleName - support optional .html suffix

commit 02f5559
Author: Patrice Chalin <[email protected]>
Date:   Mon Nov 14 04:29:17 2016 -0800

    docs: guide/index misc Jade fixes

    - Eliminate use of deprecated `clear=“all”` in `<br>`.
    - No need for local `langName`; use global `_Lang` var instead.
    - Remove duplicate id `learning-path`.

commit 14db838
Author: Naomi Black <[email protected]>
Date:   Sun Nov 13 21:48:52 2016 -0500

    news(nov): Some news and a blog post update

commit eff32ec
Author: Naomi Black <[email protected]>
Date:   Sun Nov 13 21:48:37 2016 -0500

    chore(bios): update some bios for leads

commit 3ee36fb
Author: koyner <[email protected]>
Date:   Sun Nov 13 22:59:59 2016 +0100

    docs(forms): grammar fix (#2764)

commit b11438f
Author: Ward Bell <[email protected]>
Date:   Fri Nov 11 19:44:00 2016 -0800

    docs(ts-to-js): add separate template files for some components

commit 33b6197
Author: Ward Bell <[email protected]>
Date:   Thu Nov 3 01:37:55 2016 -0700

    docs(ts-to-js): ward's edits (incomplete)

commit 12eb19f
Author: Filipe Silva <[email protected]>
Date:   Thu Oct 13 17:59:00 2016 +0100

    feat(cb-ts-to-js): add es6 examples
    update docshredder to shred .es6
    optimized focus gulp task
    convert imports and metadate sections
    add DI section
    add host and query metadata section
    add intro
    fix capitalization and grammar

commit 64a8754
Author: Patrice Chalin <[email protected]>
Date:   Thu Nov 10 20:01:36 2016 -0800

    example(template-syntax): follow style-guide and other updates (#2750)

commit 7619cdf
Author: Jesús Rodríguez <[email protected]>
Date:   Thu Nov 10 23:47:30 2016 +0100

    chore: ability to open a plunker on a specific file (#2778)

commit 0161d9d
Author: Filipe Silva <[email protected]>
Date:   Thu Nov 10 22:45:22 2016 +0000

    chore: ignore debug.log file (#2785)

    This file is generated when running `gulp e2e` and often enough committed by mistake.

    /cc @Foxandxss

commit f92983c
Author: Jesús Rodríguez <[email protected]>
Date:   Thu Nov 10 23:44:51 2016 +0100

    docs(ngmodule): fix plunkers (#2786)

commit 03db4bb
Author: Martin Eckardt <[email protected]>
Date:   Wed Nov 9 17:43:40 2016 +0100

    docs(a1-a2): fix link to Filter/Pipes (#2770)

commit 60565a5
Author: Pavol Pitonak <[email protected]>
Date:   Wed Nov 9 17:42:57 2016 +0100

    docs(testing): configureTestModule -> configureTestingModule (#2767)

commit ec47197
Author: Catalin Zalog <[email protected]>
Date:   Wed Nov 9 18:41:56 2016 +0200

    docs(style-guide): fix missing *.ts (#2763)

commit 234e468
Author: Patrice Chalin <[email protected]>
Date:   Tue Nov 8 08:21:02 2016 -0800

    docs: intra-site links should be relative

    Contributes to #2772.

commit 6b37da7
Author: Patrice Chalin <[email protected]>
Date:   Tue Nov 8 09:27:10 2016 -0800

    docs(forms/dart): remove mention of FORM_DIRECTIVES

    Fixes #2752

commit c24dd07
Author: Patrice Chalin <[email protected]>
Date:   Tue Nov 8 14:48:03 2016 -0800

    docs(toh-5/dart): use routerLink in dashboard (#2744)

    * docs(toh-5/dart): use routerLink in dashboard

    * minor edits to TS jade

    * remove dart/toh-pt5 from bad-code-excerpt-skip-patterns

commit 2808878
Author: Patrice Chalin <[email protected]>
Date:   Tue Nov 8 07:41:27 2016 -0800

    chore(deploy): don't name project in firebase deploy

    Naming the project would sometimes cause gulp to report `An unexpected
    error has occurred` with exit code 2.

commit 2649647
Author: Jesus Rodriguez <[email protected]>
Date:   Sat Nov 5 00:37:47 2016 +0100

    chore: add upgrade/static to API reference

commit 8508140
Merge: 37f93bc b1c2c27
Author: Adrian Irwin <[email protected]>
Date:   Thu Nov 3 17:27:43 2016 -0700

    Merge branch 'router' of https://github.com/adrianirwin/angular.io into router

commit 37f93bc
Author: Adrian Irwin <[email protected]>
Date:   Thu Nov 3 17:25:55 2016 -0700

    docs(router): fixed verbiage and example of how routed views are related to the router outlet

commit b1c2c27
Author: Adrian Irwin <[email protected]>
Date:   Thu Nov 3 16:57:56 2016 -0700

    docs(router): fixed verbiage and example of how routed views are related to the router outlet
  • Loading branch information
filipesilva committed Nov 15, 2016
1 parent 5fa0b69 commit eb60bfe
Show file tree
Hide file tree
Showing 207 changed files with 3,900 additions and 2,361 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public/docs/xref-*.*
_zip-output
www*
npm-debug*.log*
**/debug.log
*.plnkr.html
plnkr.html
*.eplnkr.html
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
- DBUS_SESSION_BUS_ADDRESS=/dev/null
- DISPLAY=:99.0
- CHROME_BIN=chromium-browser
- LATEST_RELEASE=2.1.1
- LATEST_RELEASE=2.2.0
- TASK_FLAGS="--dgeni-log=warn"
matrix:
- TASK=lint
Expand Down
13 changes: 7 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,16 @@ function findAndRunE2eTests(filter, outputFile) {
e2eSpecPaths.forEach(function(specPath) {
// get all of the examples under each dir where a pcFilename is found
localExamplePaths = getExamplePaths(specPath, true);
// Filter by language
localExamplePaths = localExamplePaths.filter(function (fn) {
return fn.match('/'+lang+'$') != null;
});
// Filter by example name
if (filter) {
localExamplePaths = localExamplePaths.filter(function (fn) {
return fn.match(filter) != null;
})
}
// Filter by language, also supports variations like js-es6
localExamplePaths = localExamplePaths.filter(function (fn) {
return fn.match('/'+lang+'(?:-[^/]*)?$') != null;
});
localExamplePaths.forEach(function(examplePath) {
examplePaths.push(examplePath);
})
Expand Down Expand Up @@ -754,7 +755,7 @@ gulp.task('check-deploy', ['firebase-use-proj-check', 'build-docs'], () => {
}).then(function(shouldDeploy) {
if (shouldDeploy) {
gutil.log('deploying...');
return execPromise(`firebase deploy -p ${WWW}`);
return execPromise('firebase deploy');
} else {
return ['Not deploying'];
}
Expand Down Expand Up @@ -1270,7 +1271,7 @@ function apiExamplesWatch(postShredAction) {
}

function devGuideExamplesWatch(shredOptions, postShredAction, focus) {
var watchPattern = focus ? '**/{' + focus + ',cb-' + focus+ '}/**/*.*' : '**/*.*';
var watchPattern = focus ? '{' + focus + ',cb-' + focus+ '}/**/*.*' : '**/*.*';
var includePattern = path.join(shredOptions.examplesDir, watchPattern);
// removed this version because gulp.watch has the same glob issue that dgeni has.
// var excludePattern = '!' + path.join(shredOptions.examplesDir, '**/node_modules/**/*.*');
Expand Down
6 changes: 3 additions & 3 deletions harp.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"picture": "/resources/images/bios/naomi.jpg",
"twitter": "naomitraveller",
"website": "http://google.com/+NaomiBlack",
"bio": "Naomi is Angular's TPM generalist and jack-of-all-trades. She leads Angular Material and AngularDart, and acts as webmaster for angular.io. She's been at Google since 2006, as a technical program manager on projects ranging from Accessibility to Google Transit. She fights daleks in her spare time.",
"bio": "Naomi is Angular's TPM generalist and jack-of-all-trades. She leads Angular's global programs (including localization), supports Angular's internal Google users, and acts as webmaster for angular.io and angular.cn. She's been at Google since 2006, as a technical program manager on projects ranging from Accessibility to Google Transit. She fights daleks in her spare time.",
"type": "Lead"
},

Expand All @@ -38,7 +38,7 @@
"picture": "/resources/images/bios/brad-green.jpg",
"twitter": "bradlygreen",
"website": "https://plus.google.com/+BradGreen",
"bio": "Brad Green works at Google as an engineering director. Brad manages the Google Sales Platform suite of projects as well as the AngularJS framework. Prior to Google, Brad worked on the early mobile web at AvantGo, founded and sold startups, and spent a few hard years toiling as a caterer. Brad's first job out of school was as lackey to Steve Jobs at NeXT Computer writing demo software and designing his slide presentations. Brad lives in Mountain View, CA with his wife and two children.",
"bio": "Brad Green works at Google as an engineering director. Brad manages the Google Sales Platform suite of projects as well as the AngularJS framework. Prior to Google, Brad worked on the early mobile web at AvantGo, founded and sold startups, and spent a few hard years toiling as a caterer. Brad's first job out of school was as lackey to Steve Jobs at NeXT Computer writing demo software and designing his slide presentations. Brad enjoys throwing dinner parties with his wife Heather and putting on plays with his children.",
"type": "Lead"
},

Expand All @@ -47,7 +47,7 @@
"picture": "/resources/images/bios/juleskremer.jpg",
"twitter": "jules_kremer",
"website": "https://plus.google.com/+JulesKremer",
"bio": "Jules is a TPM on the Angular team. When not working with developers, Jules is often bending into pretzel-like shapes, climbing mountains or drinking really awesome beer.",
"bio": "Jules is Head of Angular Developer Relations at Google. When not working with developers, Jules is often bending into pretzel-like shapes, climbing mountains or drinking really awesome beer.",
"type": "Lead"
},

Expand Down
2 changes: 1 addition & 1 deletion public/_includes/_footer.jade
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ div(class="main-footer" data-swiftype-index="false")
// TODO: (ericjim) make a libraries page to showcase all angular libraries
//li <a href="/libraries.html">Libraries</a>
li <a href="/about/">About</a>
li <a href="/resources/">Books & Training</a>
li <a href="/resources/#Education">Books & Training</a>
li <a href="/resources/">Tools & Libraries</a>
li <a href="/resources/">Community</a>
li <a href="/presskit.html">Press Kit</a>
Expand Down
1 change: 1 addition & 0 deletions public/docs/_examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ wallaby.js

_test-output
**/ts/**/*.js
**/js-es6*/**/*.js
**/ts-snippets/**/*.js
*.d.ts

Expand Down
1 change: 1 addition & 0 deletions public/docs/_examples/_boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
"build:cli": "ng build",
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js",
"build:babel": "babel app -d app --extensions \".es6\" --source-maps",
"copy-dist-files": "node ./copy-dist-files.js",
"i18n": "ng-xi18n"
},
Expand Down
18 changes: 9 additions & 9 deletions public/docs/_examples/cb-ts-to-js/e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node

import { browser, element, by } from 'protractor';

Expand All @@ -9,7 +9,7 @@ describe('TypeScript to Javascript tests', function () {
});

it('should display the basic component example', function () {
testTag('hero-view', 'Hero: Windstorm');
testTag('hero-view', 'Hero Detail: Windstorm');
});

it('should display the component example with lifecycle methods', function () {
Expand All @@ -36,7 +36,7 @@ describe('TypeScript to Javascript tests', function () {

it('should support component with inputs and outputs', function () {
let app = element(by.css('hero-io'));
let confirmComponent = app.element(by.css('my-confirm'));
let confirmComponent = app.element(by.css('app-confirm'));

confirmComponent.element(by.buttonText('OK')).click();
expect(app.element(by.cssContainingText('span', 'OK clicked')).isPresent()).toBe(true);
Expand All @@ -46,11 +46,11 @@ describe('TypeScript to Javascript tests', function () {
});

it('should support host bindings and host listeners', function() {
let app = element(by.css('heroes-bindings'));
let app = element(by.css('hero-host'));
let h1 = app.element(by.css('h1'));

expect(app.getAttribute('class')).toBe('heading');
expect(app.getAttribute('title')).toBe('Tooltip content');
expect(app.getAttribute('title')).toContain('Tooltip');

h1.click();
expect(h1.getAttribute('class')).toBe('active');
Expand All @@ -61,12 +61,12 @@ describe('TypeScript to Javascript tests', function () {
});

it('should support content and view queries', function() {
let app = element(by.css('heroes-queries'));
let windstorm = app.element(by.css('a-hero:first-child'));
let app = element(by.css('hero-queries'));
let windstorm = app.element(by.css('view-child:first-child'));

app.element(by.buttonText('Activate')).click();
app.element(by.css('button')).click();
expect(windstorm.element(by.css('h2')).getAttribute('class')).toBe('active');
expect(windstorm.element(by.css('active-label')).getText()).toBe('Active');
expect(windstorm.element(by.css('content-child')).getText()).toBe('Active');
});

function testTag(selector: string, expectedText: string) {
Expand Down
6 changes: 6 additions & 0 deletions public/docs/_examples/cb-ts-to-js/js-es6-decorators/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"es2015",
"angular2"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component } from '@angular/core';

@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: 'app.component.html',
styles: [
// See hero-di-inject-additional.component
'hero-host, hero-host-meta { border: 1px dashed black; display: block; padding: 4px;}',
'.heading {font-style: italic}'
]
})
export class AppComponent {
title = 'ES6 JavaScript with Decorators';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<a id="toc"></a>
<h1>{{title}}</h1>
<a href="#class-metadata">Classes and Class Metadata</a><br>
<a href="#io-metadata">Input and Output Decorators</a><br>
<a href="#dependency-injection">Dependency Injection</a><br>
<a href="#host-metadata">Host Metadata</a><br>
<a href="#view-child-metadata">View and Child Metadata</a><br>

<hr>
<h4 id="class-metadata">Classes and Class Metadata</h4>
<hero-view></hero-view>
<hero-lifecycle></hero-lifecycle>

<hr>
<h4 id="io-metadata">Input and Output Metadata</h4>
<hero-io></hero-io>

<hr>
<h4 id="dependency-injection">Dependency Injection</h4>
<hero-di></hero-di>
<hero-di-inject></hero-di-inject>
<hero-di-inject-additional></hero-di-inject-additional>

<hr>
<h4 id="host-metadata">Host Metadata</h4>
<hero-host></hero-host>
<hero-host-meta></hero-host-meta>

<hr>
<h4 id="view-child-metadata">View and Child Metadata</h4>
<hero-queries></hero-queries>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { ConfirmComponent } from './confirm.component';
// #docregion appimport
import { HeroComponent } from './hero.component';
// #enddocregion appimport
import { HeroComponent as HeroDIComponent } from './hero-di.component';
import { HeroComponent as HeroDIInjectComponent } from './hero-di-inject.component';
import { HeroComponent as HeroDIInjectAdditionalComponent } from './hero-di-inject-additional.component';
import { HeroHostComponent } from './hero-host.component';
import { HeroHostMetaComponent } from './hero-host-meta.component';
import { HeroIOComponent } from './hero-io.component';
import { HeroComponent as HeroLifecycleComponent } from './hero-lifecycle.component';
import { HeroQueriesComponent, ViewChildComponent, ContentChildComponent } from './hero-queries.component';
import { HeroTitleComponent } from './hero-title.component';

import { DataService } from './data.service';

@NgModule({
imports: [
BrowserModule
],
declarations: [
AppComponent,
ConfirmComponent,
HeroComponent,
HeroDIComponent,
HeroDIInjectComponent,
HeroDIInjectAdditionalComponent,
HeroHostComponent, HeroHostMetaComponent,
HeroIOComponent,
HeroLifecycleComponent,
HeroQueriesComponent, ViewChildComponent, ContentChildComponent,
HeroTitleComponent
],
providers: [
DataService,
{ provide: 'heroName', useValue: 'Windstorm' }
],
bootstrap: [ AppComponent ],

// schemas: [ NO_ERRORS_SCHEMA ] // helpful for debugging
})
export class AppModule { }

/* tslint:disable no-unused-variable */
// #docregion ng2import
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {
LocationStrategy,
HashLocationStrategy
} from '@angular/common';
// #enddocregion ng2import
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';

// #docregion
@Component({
moduleId: module.id,
selector: 'app-confirm',
templateUrl: 'confirm.component.html'
})
export class ConfirmComponent {
@Input() okMsg = '';
@Input('cancelMsg') notOkMsg = '';
@Output() ok = new EventEmitter();
@Output('cancel') notOk = new EventEmitter();

onOkClick() {
this.ok.emit(true);
}
onNotOkClick() {
this.notOk.emit(true);
}
}
// #enddocregion
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<button (click)="onOkClick()">
{{okMsg}}
</button>
<button (click)="onNotOkClick()">
{{notOkMsg}}
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Injectable } from '@angular/core';

@Injectable()
export class DataService {
constructor() { }

getHeroName() {
return 'Windstorm';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Component } from '@angular/core';

@Component({
selector: 'hero-di-inject-additional',
template: `<hero-title title="Tour of Heroes"></hero-title>`
})
export class HeroComponent { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component, Inject } from '@angular/core';

// #docregion
@Component({
selector: 'hero-di-inject',
template: `<h1>Hero: {{name}}</h1>`
})
export class HeroComponent {
constructor(@Inject('heroName') name) {
this.name = name;
}
}
// #enddocregion
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component } from '@angular/core';
import { DataService } from './data.service';

// #docregion
@Component({
selector: 'hero-di',
template: `<h1>Hero: {{name}}</h1>`
})
export class HeroComponent {
name = '';
constructor(dataService: DataService) {
this.name = dataService.getHeroName();
}
}
// #enddocregion
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Component } from '@angular/core';

// #docregion
@Component({
selector: 'hero-host-meta',
template: `
<h1 [class.active]="active">Hero Host in Metadata</h1>
<div>Heading clicks: {{clicks}}</div>
`,
host: {
// HostBindings to the <hero-host-meta> element
'[title]': 'title',
'[class.heading]': 'headingClass',

// HostListeners on the entire <hero-host-meta> element
'(click)': 'clicked()',
'(mouseenter)': 'enter($event)',
'(mouseleave)': 'leave($event)'
},
// Styles within (but excluding) the <hero-host-meta> element
styles: ['.active {background-color: coral;}']
})
export class HeroHostMetaComponent {
title = 'Hero Host in Metadata Tooltip';
headingClass = true;

active = false;
clicks = 0;

clicked() {
this.clicks += 1;
}

enter(event: Event) {
this.active = true;
this.headingClass = false;
}

leave(event: Event) {
this.active = false;
this.headingClass = true;
}
}
// #enddocregion
Loading

0 comments on commit eb60bfe

Please sign in to comment.