docs(aio): rename cb- files and a few others

This commit is contained in:
Ward Bell
2017-04-21 17:21:45 -07:00
committed by Pete Bacon Darwin
parent c3fa8803d3
commit 93516ea8a1
543 changed files with 467 additions and 510 deletions

View File

@ -0,0 +1,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'sg-app',
template: '<toh-hero-list></toh-hero-list>'
})
export class AppComponent { }

View File

@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { HeroComponent, HeroListComponent } from './heroes';
@NgModule({
imports: [
BrowserModule,
RouterModule.forChild([{ path: '05-17', component: AppComponent }])
],
declarations: [
AppComponent,
HeroComponent,
HeroListComponent
],
exports: [ AppComponent ]
})
export class AppModule {}

View File

@ -0,0 +1,24 @@
// #docregion
import { Component } from '@angular/core';
import { Hero } from '../shared/hero.model';
// #docregion example
/* avoid */
@Component({
selector: 'toh-hero-list',
template: `
<section>
Our list of heroes:
<hero-profile *ngFor="let hero of heroes" [hero]="hero">
</hero-profile>
Total powers: {{totalPowers}}<br>
Average power: {{totalPowers / heroes.length}}
</section>
`
})
export class HeroListComponent {
heroes: Hero[];
totalPowers: number;
}
// #enddocregion example

View File

@ -0,0 +1,35 @@
// #docplaster
// #docregion
import { Component } from '@angular/core';
import { Hero } from '../shared/hero.model';
// #docregion example
@Component({
selector: 'toh-hero-list',
template: `
<section>
Our list of heroes:
<toh-hero *ngFor="let hero of heroes" [hero]="hero">
</toh-hero>
Total powers: {{totalPowers}}<br>
Average power: {{avgPower}}
</section>
`
})
export class HeroListComponent {
heroes: Hero[];
totalPowers: number;
// #enddocregion example
// testing harness
constructor() {
this.heroes = [];
}
// #docregion example
get avgPower() {
return this.totalPowers / this.heroes.length;
}
}
// #enddocregion example

View File

@ -0,0 +1 @@
export * from './hero-list.component';

View File

@ -0,0 +1,13 @@
import { Component, Input } from '@angular/core';
import { Hero } from '../shared/hero.model';
@Component({
selector: 'toh-hero',
template: `...`
})
export class HeroComponent {
@Input() hero: Hero;
}

View File

@ -0,0 +1 @@
export * from './hero.component';

View File

@ -0,0 +1,3 @@
export * from './hero';
export * from './hero-list';
export * from './shared';

View File

@ -0,0 +1,5 @@
// #docregion
export class Hero {
id: number;
name: string;
}

View File

@ -0,0 +1 @@
export * from './hero.model';

View File

@ -0,0 +1,2 @@
export * from './heroes';
export * from './app.component';