Discussions

Ask a Question
Back to All

Handling form-data

Hello there! First of all, thank you for this awesome project. Really helpful to have a convenient model layer in the AngularJS world.

I have a question regarding form-data. Is there any documentation how to handle form-data with JS Data? I'm switching from $resource which allowed me to attach a CSV file to the request via a simple 'transformRequest' like this:

var data = $resource('/data/:id', {}, {
post: {
method: 'POST',
transformRequest: function(data) {
var fd = new FormData();
fd.append('file', data);
return fd;
},
headers: {'Content-Type': undefined}
}
};

I couldn't figure out how to do the same with JS Data.