docs(aio): rename cb- files and a few others
This commit is contained in:

committed by
Pete Bacon Darwin

parent
c3fa8803d3
commit
93516ea8a1
@ -0,0 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'sg-app',
|
||||
template: '<toh-hero-list></toh-hero-list>'
|
||||
})
|
||||
export class AppComponent { }
|
20
aio/content/examples/styleguide/src/05-17/app/app.module.ts
Normal file
20
aio/content/examples/styleguide/src/05-17/app/app.module.ts
Normal 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 {}
|
@ -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
|
@ -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
|
@ -0,0 +1 @@
|
||||
export * from './hero-list.component';
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
export * from './hero.component';
|
@ -0,0 +1,3 @@
|
||||
export * from './hero';
|
||||
export * from './hero-list';
|
||||
export * from './shared';
|
@ -0,0 +1,5 @@
|
||||
// #docregion
|
||||
export class Hero {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
@ -0,0 +1 @@
|
||||
export * from './hero.model';
|
2
aio/content/examples/styleguide/src/05-17/app/index.ts
Normal file
2
aio/content/examples/styleguide/src/05-17/app/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './heroes';
|
||||
export * from './app.component';
|
Reference in New Issue
Block a user