Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export class HeroService {
// #enddocregion getHeroes, getHeroes-1, getHeroes-2

// #docregion getHeroNo404
/** IDによりヒーローを取得. idが見つからない場合は`undefined`を返す */
/** IDによりヒーローを取得する。idが見つからない場合は`undefined`を返す */
getHeroNo404<Data>(id: number): Observable<Hero> {
const url = `${this.heroesUrl}/?id=${id}`;
return this.http.get<Hero[]>(url)
.pipe(
map(heroes => heroes[0]), // returns a {0|1} element array
map(heroes => heroes[0]), // {0|1} 要素の配列を返す
// #enddocregion getHeroNo404
tap(h => {
const outcome = h ? `fetched` : `did not find`;
Expand All @@ -68,7 +68,7 @@ export class HeroService {
// #enddocregion getHeroNo404

// #docregion getHero
/** IDによりヒーローを取得。見つからなかった場合は404を返却 */
/** IDによりヒーローを取得する。見つからなかった場合は404を返却する。 */
getHero(id: number): Observable<Hero> {
const url = `${this.heroesUrl}/${id}`;
return this.http.get<Hero>(url).pipe(
Expand Down Expand Up @@ -129,7 +129,7 @@ export class HeroService {

// #docregion handleError
/**
* 失敗したHttp操作を処理します
* 失敗したHttp操作を処理します
* アプリを持続させます。
* @param operation - 失敗した操作の名前
* @param result - observableな結果として返す任意の値
Expand Down
1 change: 1 addition & 0 deletions aio-ja/content/tutorial/toh-pt6.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ CLIは`HeroSearchComponent`を作成し、`AppModule`のdeclarationsにそのコ

<div class="l-sub-section">


[switchMap operator](http://www.learnrxjs.io/operators/transformation/switchmap.html)により
すべての適格なキーイベントが`HttpClient.get`メソッドを呼び出すことができます。
各リクエスト間の300msの休止により、複数のHTTPリクエストを送信できますが、それらは順序どおりに戻ってこないかもしれません。
Expand Down