I have some categories in a formcontrol, I send them in an array of string like this:
[1,4,6]
And that is my actual code:
let categoryIds = new Array<String>()
this.selectedCategories.forEach((value: string, key: string) =>
categoryIds.push(key))
let requestOptions = {
params: new HttpParams()
.set('title', this.createNewForm.controls['title'].value)
.append('content', this.createNewForm.controls['content'].value)
.append('categoryids', categoryIds.toString()),
withCredentials: true
}
But I want to send them as an array of objects, with the old version of angular Http I was able to do a foreach of the object and append every category. But I don't know how to get every category and make each one an append to params. I need to get like this:
...categoryId=1&categoryId=4&categoryId=6...