Hi I'm new to angular hence got stuck at one place. I need to pass array as parameters to backend API backend API expects array of string as parameters
const params = new HttpParams();
const depKey = ['deploymentInprogress', 'deploymentMessage'];
params.append('depKey', JSON.stringify(depKey));
this.http.get(uri, { params: params })
.pipe(
take(1),
catchError((error) => {
return throwError(error);
})
).subscribe(data => {
})
The above code didn't work Need an help on this I'm not sure how we can pass array of strings as params to our backend API
You can do this:
const params = new HttpParams();
const depKey = ['deploymentInprogress', 'deploymentMessage'];
params.append('depKey', depKey.join(', ');
this.http.get(uri, { params: params }).....