1
我已經建立供應商頁面,我有我的文章,並在其中HTTP觀察到的回報空
在這裏得到的要求就是我的服務返回觀察到的
post(url: string,data:any): Observable<any>{
return this.http.post(this.configurator.restServerBaseUrl+url,data)
.map((result:Response)=> {
result.json()
})
}
這裏是我的部分代碼
submit(){
this.rest.post('/validateUser',validateUserObj)
.subscribe((result)=>{
this.logger.debug("checking data of success " +JSON.stringify(result));
});
}
}
這裏我的結果是給我不確定
在我的服務,如果我映射這樣的,如果我申請託架我得到不確定的,它工作正常
.map((result:Response)=>result.json())
。
能有人幫我瞭解我觀察到在angula.io檢查了,但我覺得很難理解有
你可以在這裏看到'post(url:string,data:any):Observable'我試圖返回可觀測值,如果我嘗試返回x,就像你說的那樣意味着我不返回任何可觀察值。所以根據你的回答它返回的是什麼幫助 –
這只是一個通用的例子。在你的情況下,只需在'result.json()'之前添加'return' –