我有一個使用角度的HTTP服務可觀察到由服務返回的將無法完成
@Injectable()
export class MyService {
constructor(private http: Http) { }
getThings() {
return this.http.get('url').map((res) => {
// massage data here and return massaged data
});
}
}
服務我使用這樣
this.myService.getThings.subscribe(
things => {},
err => {},
() => {
// never completes...
});
服務爲什麼myService.getThings()
從來沒有完成,雖然http.get('url')
完成?
我該如何讓myService.getThings()
完成?
這可能對你很有趣:https://github.com/angular/angular/issues/7865 –
你解決了這個問題嗎? –
我使用finally方法 – Lev