I am trying to set a key value pair in the HttpParams that has a dynamic key value, for example:
let params = new HttpParams();
properties.forEach(p => {
params = params.appendAll({ p.id : p.value})
}
But the p.id does not work as it expects to receive a string. how can I accomplish such result?
params = params.appendAll({ [p.id] : p.value})
You need to bind it this way