如何在Angular 5中传递3个参数而不是2个HttpClientModule

时间:2018-06-05 07:32:57

标签: angular

我尝试将3个参数发送到后端路由器

// Function to get user's profile image
getProfileImage(): Observable<Blob>{
  this.createAuthenticationHeaders(); // Create headers before sending to API
  return this._http.get(this.domain + '/authentication/getProfileImageok', this.options, { responseType: "blob" });
}

但它说它只能发送两个

1 个答案:

答案 0 :(得分:0)

不,如果你想发送一些你必须附加到选项的参数作为get请求的第二个参数,你不能按官方文档发送三个参数。

演示对象 -

get(url: string, options: {
    headers?: HttpHeaders | {
        [header: string]: string | string[];
    };
    observe?: HttpObserve;
    params?: HttpParams | {
        [param: string]: string | string[];
    };
    reportProgress?: boolean;
    responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
    withCredentials?: boolean;
} = {}): Observable<any> 

有关详细信息,请参阅此处。