Angluar2アプリのObservablesに問題があります。 2つの別々のhttp呼び出しを行う必要があるという仮説的な状況を想定してみましょう。 1つのコールは、他のコールの結果に直接依存します。コードは次のようになります。Observableを使用した2つの同期httpコール
this.http.get('http://kalafior/group/'+id)
.map(res => res.json())
.subscribe(group => {
//url depends on previous call result
this.http.get('http://kalafior/group/'+group.id+'/posts')
.map(res => res.json())
.subscribe((res) => {
console.log(res);
});
});
削除したいsubscribe()呼び出しがネストされています。
同じタイプ、あなたはより良い理解を得るために、ここでそれを確認することができますhttp://stackoverflow.com/questions/35268482/chaining-rxjs-observables-from-http-data-in-angular2-with -typeescript?rq = 1 –