简体   繁体   English

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

[英]How to pass 3 arguments instead of 2 in Angular 5 HttpClientModule

I trying to send 3 parameters to the back-end Router 我试图将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" });
}

but it said that it only can send two 但说只能寄两个

No, You can't send three params as per official documentation if you want to send some params you must be attached to options as the second parameter of the get request. 不,如果要发送某些参数,则不能按照官方文档发送三个参数,必须将这些参数附加到get请求的第二个参数中。

Demo object - 演示对象-

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> 

For more information refer here. 有关更多信息,请参见此处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM