This is my array of actors:
[\'Elvis\', \'Jane\', \'Frances\']
How to pass this array within a query strin
I've used this method and it worked for me in Angular 10:
private paramMaker(data) : HttpParams
{
let httpParams = new HttpParams();
Object.keys(data).forEach((key) = > {
if (Array.isArray(data[key]))
{
data[key].forEach((item, index) = > {
httpParams = httpParams.append(key + '[' + index + ']', item);
});
}
else
{
httpParams = httpParams.append(key, data[key]);
}
});
return httpParams;
}