0
我的代碼是如何使用角度2中的Observable獲得http響應(成功或失敗)?
this.slimLoaderService.start();
return this.http.post(url, data, options)
.map(this.getResult)
.catch(this.handleError);
我需要添加一個this.slimLoaderService.complete();一旦我得到http響應就停止加載器。
您需要申請才能真正發送請求。您將在subscribe函數中編寫您的slimLoaderService.stop()代碼。 – Sefa
添加'.finally(()=> this.slimLoaderService.complete())'。 –
@JBNizet酷它工作得很好。我不知道最後的方法,我試着做但得到了一些問題,謝謝 – Niyaz