component :
import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
const URL = 'http://localhost:4200/api/ticketsystem/createticket';
public uploader: FileUploader = new FileUploader({ url: URL, itemAlias: 'file' });
this.uploader.onAfterAddingFile = (file) => { file.withCredentials = false; };
ngOnInIt(){
this.uploader.onCompleteItem = (item: any, response: any, status: any, headers: any) => {
console.log("ImageUpload:uploaded:", item, status, response);
};
this.uploader.onBeforeUploadItem = (item: any) => {
var ll = {
"severity": this.ticket.severity,
"subject": this.ticket.subject,
"description": this.ticket.description,
"priority": "High",
"status": "Open",
"owner": {
"id": this.userDetails[0].id
}
}
item.formData.push({ "ticket": JSON.stringify(ll) })
}
}
I have tried file upload using ng2-file-upload if i normally upload file means it can be upload but i need to send some input json object.
The above code uploader.onBeforeLoadItem method i have constructed json object what i need to send with uploader. Here i need help how send my input value with formdata object, I need help on this
– Apr 05 '18 at 13:54