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,5 @@
<ul>
<li *ngFor="let hero of heroes">
{{hero.name}}
</li>
</ul>

View File

@ -0,0 +1,18 @@
import { Component, OnInit } from '@angular/core';
import { Hero, HeroService } from './heroes';
@Component({
selector: 'sg-app',
templateUrl: './app.component.html',
providers: [HeroService]
})
export class AppComponent implements OnInit {
heroes: Hero[];
constructor(private heroService: HeroService) { }
ngOnInit() {
this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes);
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,17 @@
// #docregion
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Hero } from './hero.model';
@Injectable()
// #docregion example
export class HeroService {
constructor(private http: Http) { }
getHeroes() {
return this.http.get('api/heroes')
.map((response: Response) => <Hero[]>response.json().data);
}
}
// #enddocregion example

View File

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

View File

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