No more nonsense to say, directly to everyone paste code.
$http ({
URL: "Http://localhost:10086/yuanxin/Conference/ImportExcelDataForBusRoute", Method
: ' Post ',
headers: {
' content-type ': ' Multipart/form-data '
},
data: {busroute:file, Conferenceid: "1"},
Transformrequest:function (data, Headersgetter) {//Format conversion, very critical
var formData = new FormData ()//Convert model to form format
Angular.foreach (data, function (value, key) {
formdata.append (key, value);
});
var headers = Headersgetter ();
Delete headers[' Content-type '];
Return FormData
}
}). Success (function (data) {
$scope. issubming = false;
$scope. Busroutecoll = data.datalist;
$scope. pageIndex = 1;
$scope. PageCount = Data.pagecount;
alert (DATA.PROPERTY.MP);
}). Error (function (ex, state) {
alert (ex);
Console.log (state + ":" + ex.exceptionmessage);
Console.log (ex.stacktrace);
$scope. issubming = false;
});
The above is a small set to introduce the Angularjs imitation form form submission of the implementation code, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!