Http post and get request in angular 6

后端 未结 3 1687
时光取名叫无心
时光取名叫无心 2020-12-14 00:51

In angular 5.2.x for http get and post I had this code:

post(url: string, model: any): Observable {

return this.http.post(url, model)
  .map(         


        
3条回答
  •  误落风尘
    2020-12-14 01:24

    For reading full response in Angular you should add the observe option:

    { observe: 'response' }
    
        return this.http.get(`${environment.serverUrl}/api/posts/${postId}/comments/?page=${page}&size=${size}`, { observe: 'response' });
    

提交回复
热议问题