Issue
When i try to send a map object with FormData its give an error like;
TS2345: Argument of type 'Map<number, number>' is not assignable to parameter of type 'string | Blob'. Type 'Map<number, number>' is missing the following properties from type 'Blob': type, arrayBuffer, slice, stream, tex
How can i send this object with formdata to my .net API ?
Solution
Convert to json and send like this
var content = '{ json data here }';
var blob = new Blob([content], { type: "text/json"});
formData.append("jsonData", blob);
OR
new Blob([JSON.stringify({
description: 'description',
})], {
type: 'application/json'
})
Answered By - Onur İnci
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.