Hello there, I'm currently developing an application using Angular 8 and integrating web.api within .net core 2.2.
One of the challenges I encountered is dealing with multi-selectable checkboxes in a form that also includes "regular" inputs and file upload functionality.
To handle the array of numbers from the multi-selectable checkboxes, I convert my FormGroup into FormData before posting it to the server. I manually add the file and the array of integers like this:
data.append('locationsSecondaryIds',
new Blob( [ JSON.stringify(this.profilePersonalData.locationsSecondaryIds)], { type : 'application/json' } ) );
if (this.file) {
data.append('document', this.file, this.file.name);
}
The variable locationsSecondaryIds represents a number array.
I have attempted to send the data without converting it to a Blob by simply sending [1,1], but unfortunately, the server is unable to convert it to a List on receiving the request.
If anyone has any suggestions or solutions to this issue, I would greatly appreciate your help!
Thank you in advance for your assistance :-)