diff --git a/public/docs/_examples/toh-6/ts/app/dashboard.component.ts b/public/docs/_examples/toh-6/ts/app/dashboard.component.ts index 6070e76eb6..988d51fee9 100644 --- a/public/docs/_examples/toh-6/ts/app/dashboard.component.ts +++ b/public/docs/_examples/toh-6/ts/app/dashboard.component.ts @@ -16,17 +16,17 @@ export class DashboardComponent implements OnInit { heroes: Hero[] = []; constructor( - private _router: Router, - private _heroService: HeroService) { + private router: Router, + private heroService: HeroService) { } ngOnInit() { - this._heroService.getHeroes() + this.heroService.getHeroes() .then(heroes => this.heroes = heroes.slice(1,5)); } gotoDetail(hero: Hero) { let link = ['HeroDetail', { id: hero.id }]; - this._router.navigate(link); + this.router.navigate(link); } } diff --git a/public/docs/_examples/toh-6/ts/app/hero-detail.component.ts b/public/docs/_examples/toh-6/ts/app/hero-detail.component.ts index 7b2889e592..4920273f20 100644 --- a/public/docs/_examples/toh-6/ts/app/hero-detail.component.ts +++ b/public/docs/_examples/toh-6/ts/app/hero-detail.component.ts @@ -1,10 +1,11 @@ // #docplaster // #docregion -import { Component, Input, Output, OnInit, EventEmitter } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { RouteParams } from '@angular/router-deprecated'; import { Hero } from './hero'; import { HeroService } from './hero.service'; + @Component({ selector: 'my-hero-detail', templateUrl: 'app/hero-detail.component.html', @@ -17,16 +18,16 @@ export class HeroDetailComponent implements OnInit { navigated = false; // true if navigated here constructor( - private _heroService: HeroService, - private _routeParams: RouteParams) { + private heroService: HeroService, + private routeParams: RouteParams) { } // #docregion ngOnInit ngOnInit() { - if (this._routeParams.get('id') !== null) { - let id = +this._routeParams.get('id'); + if (this.routeParams.get('id') !== null) { + let id = +this.routeParams.get('id'); this.navigated = true; - this._heroService.getHero(id) + this.heroService.getHero(id) .then(hero => this.hero = hero); } else { this.navigated = false; @@ -36,7 +37,7 @@ export class HeroDetailComponent implements OnInit { // #enddocregion ngOnInit // #docregion save save() { - this._heroService + this.heroService .save(this.hero) .then(hero => { this.hero = hero; // saved hero, w/ id if new diff --git a/public/docs/_examples/toh-6/ts/app/hero.service.ts b/public/docs/_examples/toh-6/ts/app/hero.service.ts index b4b0854141..fa1e1ac4e4 100644 --- a/public/docs/_examples/toh-6/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-6/ts/app/hero.service.ts @@ -1,7 +1,7 @@ // #docplaster // #docregion import { Injectable } from '@angular/core'; -import { Http, Headers } from '@angular/http'; +import { Headers, Http } from '@angular/http'; // #docregion rxjs import 'rxjs/add/operator/toPromise'; diff --git a/public/docs/_examples/toh-6/ts/app/heroes.component.ts b/public/docs/_examples/toh-6/ts/app/heroes.component.ts index 71ce908c60..df3f26c69b 100644 --- a/public/docs/_examples/toh-6/ts/app/heroes.component.ts +++ b/public/docs/_examples/toh-6/ts/app/heroes.component.ts @@ -21,11 +21,11 @@ export class HeroesComponent implements OnInit { error: any; constructor( - private _router: Router, - private _heroService: HeroService) { } + private router: Router, + private heroService: HeroService) { } getHeroes() { - this._heroService + this.heroService .getHeroes() .then(heroes => this.heroes = heroes) .catch(error => this.error = error); // TODO: Display error message @@ -46,7 +46,7 @@ export class HeroesComponent implements OnInit { // #docregion delete delete(hero: Hero, event: any) { event.stopPropagation(); - this._heroService + this.heroService .delete(hero) .then(res => { this.heroes = this.heroes.filter(h => h !== hero); @@ -66,6 +66,6 @@ export class HeroesComponent implements OnInit { } gotoDetail() { - this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]); + this.router.navigate(['HeroDetail', { id: this.selectedHero.id }]); } } diff --git a/public/docs/ts/latest/tutorial/toh-pt6.jade b/public/docs/ts/latest/tutorial/toh-pt6.jade index fd994476a1..a3cbccec48 100644 --- a/public/docs/ts/latest/tutorial/toh-pt6.jade +++ b/public/docs/ts/latest/tutorial/toh-pt6.jade @@ -201,7 +201,7 @@ code-example(format="." language="bash"). :marked ### Save - We combine the call to the private `_post` and `_put` methods in a single `save` method. This simplifies the public api and makes the integration with `HeroDetailComponent` easier. `HeroService` determines which method to call based on the state of the `hero` object. If the hero already has an id we know it's an edit. Otherwise we know it's an add. + We combine the call to the private `post` and `put` methods in a single `save` method. This simplifies the public api and makes the integration with `HeroDetailComponent` easier. `HeroService` determines which method to call based on the state of the `hero` object. If the hero already has an id we know it's an edit. Otherwise we know it's an add. +makeExample('toh-6/ts/app/hero.service.ts', 'save', 'app/hero.service.ts (save hero)')(format=".")