1
角度2+のhttp.requestでFormDataとjsonオブジェクトを同時に送信する方法はありますか?私はangular2 +の解を必要とします。Jsonデータ+ FormDataで角度2+送信リクエスト
let data = {id: 1, name: 'test'};
let formData = new FormData();
formData.append('fileData', file); //file from inputfile
let headers = new Headers();
headers.append('Accept', 'application/json');
let options = new RequestOptions({ headers: headers });
options.method = 'POST';
options.body = data; //data is my object
//options.formData= formData; //formData is my FormData with file data to upload
this.http.request(url, options);
要求を行います。https://stackoverflow.com/questions/39693966/how-to-angular2-json-data-and-same-same-request/47408232#47408232 – Maxime