Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 129b34c

Browse files
Foxandxsswardbell
authored andcommitted
docs(toh): update HTTP chapter with style guide conventions
closes #1477
1 parent 6475b5e commit 129b34c

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

public/docs/_examples/toh-6/ts/app/dashboard.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ export class DashboardComponent implements OnInit {
1616
heroes: Hero[] = [];
1717

1818
constructor(
19-
private _router: Router,
20-
private _heroService: HeroService) {
19+
private router: Router,
20+
private heroService: HeroService) {
2121
}
2222

2323
ngOnInit() {
24-
this._heroService.getHeroes()
24+
this.heroService.getHeroes()
2525
.then(heroes => this.heroes = heroes.slice(1,5));
2626
}
2727

2828
gotoDetail(hero: Hero) {
2929
let link = ['HeroDetail', { id: hero.id }];
30-
this._router.navigate(link);
30+
this.router.navigate(link);
3131
}
3232
}

public/docs/_examples/toh-6/ts/app/hero-detail.component.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// #docplaster
22
// #docregion
3-
import { Component, Input, Output, OnInit, EventEmitter } from '@angular/core';
3+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
44
import { RouteParams } from '@angular/router-deprecated';
55

66
import { Hero } from './hero';
77
import { HeroService } from './hero.service';
8+
89
@Component({
910
selector: 'my-hero-detail',
1011
templateUrl: 'app/hero-detail.component.html',
@@ -17,16 +18,16 @@ export class HeroDetailComponent implements OnInit {
1718
navigated = false; // true if navigated here
1819

1920
constructor(
20-
private _heroService: HeroService,
21-
private _routeParams: RouteParams) {
21+
private heroService: HeroService,
22+
private routeParams: RouteParams) {
2223
}
2324

2425
// #docregion ngOnInit
2526
ngOnInit() {
26-
if (this._routeParams.get('id') !== null) {
27-
let id = +this._routeParams.get('id');
27+
if (this.routeParams.get('id') !== null) {
28+
let id = +this.routeParams.get('id');
2829
this.navigated = true;
29-
this._heroService.getHero(id)
30+
this.heroService.getHero(id)
3031
.then(hero => this.hero = hero);
3132
} else {
3233
this.navigated = false;
@@ -36,7 +37,7 @@ export class HeroDetailComponent implements OnInit {
3637
// #enddocregion ngOnInit
3738
// #docregion save
3839
save() {
39-
this._heroService
40+
this.heroService
4041
.save(this.hero)
4142
.then(hero => {
4243
this.hero = hero; // saved hero, w/ id if new

public/docs/_examples/toh-6/ts/app/hero.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// #docplaster
22
// #docregion
33
import { Injectable } from '@angular/core';
4-
import { Http, Headers } from '@angular/http';
4+
import { Headers, Http } from '@angular/http';
55

66
// #docregion rxjs
77
import 'rxjs/add/operator/toPromise';

public/docs/_examples/toh-6/ts/app/heroes.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export class HeroesComponent implements OnInit {
2121
error: any;
2222

2323
constructor(
24-
private _router: Router,
25-
private _heroService: HeroService) { }
24+
private router: Router,
25+
private heroService: HeroService) { }
2626

2727
getHeroes() {
28-
this._heroService
28+
this.heroService
2929
.getHeroes()
3030
.then(heroes => this.heroes = heroes)
3131
.catch(error => this.error = error); // TODO: Display error message
@@ -46,7 +46,7 @@ export class HeroesComponent implements OnInit {
4646
// #docregion delete
4747
delete(hero: Hero, event: any) {
4848
event.stopPropagation();
49-
this._heroService
49+
this.heroService
5050
.delete(hero)
5151
.then(res => {
5252
this.heroes = this.heroes.filter(h => h !== hero);
@@ -66,6 +66,6 @@ export class HeroesComponent implements OnInit {
6666
}
6767

6868
gotoDetail() {
69-
this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]);
69+
this.router.navigate(['HeroDetail', { id: this.selectedHero.id }]);
7070
}
7171
}

public/docs/ts/latest/tutorial/toh-pt6.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ code-example(format="." language="bash").
201201
:marked
202202
### Save
203203

204-
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.
204+
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.
205205

206206
+makeExample('toh-6/ts/app/hero.service.ts', 'save', 'app/hero.service.ts (save hero)')(format=".")
207207

0 commit comments

Comments
 (0)