Showing json data in textbox - angularjs

I want to show json data to text box. but it is not showing in text box
my code is
var app = angular.module('productApp', []);
app.controller('productController', function($scope, $http) {
var x = 1054;
alert(x);
$http({
method: 'GET',
url: 'getProduct',
params: {
id: x
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).success(function(response, status, headers, config) {
console.log(response);
$scope.products = response;
})
.error(function(data, status, headers, config) {
alert("Opps unable to connect to server");
});
}); <
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.min.js"></script>
<div class="container">
<div class="all-data" ng-app="productApp" ng-controller="productController">
<form id="updateProduct" action="UpdatedProduct" method="post">
<legend>Update Product</legend>
<div class="products" ng-repeat="p in products">
{{p.id}}{{p.unitPrice}}
<input type="hidden" ng-model="p.id" />
<label>Bar Code</label>
<input type="text" name="barCode" class="form-control" id="barCode" ng-model="p.barcode" />
<label> Quantity </label>
<input type="text" name="quantity" ng-model="p.quantity" class="form-control" id="quantity" />
<label>Unit Price</label>
<input type="text" name="unitPrice" ng-model="p.unitPrice" class="form-control" id="unitPrice" />
<label>Selling Price</label>
<input type="text" name="sellingPrice" class="form-control" id="sellingPrice" ng-model="p.sellingPrice" data-validation="required" data-validation-error-msg="Selling price required" />
<label>Discount Percentage</label>
<input type="text" name="discountPercentage" class="form-control" id="discountPercentage" ng-model="p.discountPercentage" />
<label>Tax1</label>
<input type="text" name="tax1name" class="form-control" id="tax1name" ng-model="p.tax1.name" />
<input type="hidden" name="tax1id" class="form-control" id="tax1id" ng-model="p.tax1.id" />
<input type="hidden" name="tax1value" class="form-control" id="tax1val" ng-model="p.tax1.value" />
<label>Tax2</label>
<input type="text" name="tax2name" class="form-control" id="tax2name" ng-model="p.tax2.name" />
<input type="hidden" name="tax2id" class="form-control" id="tax2id" ng-model="p.tax2.id" />
<input type="hidden" name="tax2value" class="form-control" id="tax2val" ng-model="p.tax2.value" />
<button type="submit" class="form-control btn btn-success" style="margin-top: 10px" ng-click="update(p)">Update</button>
</div>
</div>
my json data is
{"productList":[{"discountPercentage":3,"id":1054,"quantity":234,"sellingPrice":555.00,"tax1id":0,"tax1value":0,"tax2id":0,"tax2value":0,"unitPrice":234.00}]}

Try this one
}).success(function(response, status, headers, config) {
console.log(response);
$scope.products = response.productList;
})

Use response.data.productList,
$http({
method: 'GET',
url: 'getProduct',
params: {
id: x
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).success(function(response, status, headers, config) {
console.log(response);
$scope.products = response.data.productList;
})
.error(function(data, status, headers, config) {
alert("Opps unable to connect to server");
});

You either need to iterate over products.productList or, assign $scope.products = response.productList.
Here's working example: (I have used $timeout to simulate API call)
var app = angular.module('productApp', []);
app.controller('productController', function($scope, $timeout) {
var x = 1054;
alert(x);
$timeout(function() {
$scope.products = {
"productList": [{
"discountPercentage": 3,
"id": 1054,
"quantity": 234,
"sellingPrice": 555.00,
"tax1id": 0,
"tax1value": 0,
"tax2id": 0,
"tax2value": 0,
"unitPrice": 234.00
}]
}
}, 1000)
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.min.js"></script>
<div class="container">
<div class="all-data" ng-app="productApp" ng-controller="productController">
<form id="updateProduct" action="UpdatedProduct" method="post">
<legend>Update Product</legend>
<div class="products" ng-repeat="p in products.productList">
{{p.id}}{{p.unitPrice}}
<input type="hidden" ng-model="p.id" />
<label>Bar Code</label>
<input type="text" name="barCode" class="form-control" id="barCode" ng-model="p.barcode" />
<label> Quantity </label>
<input type="text" name="quantity" ng-model="p.quantity" class="form-control" id="quantity" />
<label>Unit Price</label>
<input type="text" name="unitPrice" ng-model="p.unitPrice" class="form-control" id="unitPrice" />
<label>Selling Price</label>
<input type="text" name="sellingPrice" class="form-control" id="sellingPrice" ng-model="p.sellingPrice" data-validation="required" data-validation-error-msg="Selling price required" />
<label>Discount Percentage</label>
<input type="text" name="discountPercentage" class="form-control" id="discountPercentage" ng-model="p.discountPercentage" />
<label>Tax1</label>
<input type="text" name="tax1name" class="form-control" id="tax1name" ng-model="p.tax1.name" />
<input type="hidden" name="tax1id" class="form-control" id="tax1id" ng-model="p.tax1.id" />
<input type="hidden" name="tax1value" class="form-control" id="tax1val" ng-model="p.tax1.value" />
<label>Tax2</label>
<input type="text" name="tax2name" class="form-control" id="tax2name" ng-model="p.tax2.name" />
<input type="hidden" name="tax2id" class="form-control" id="tax2id" ng-model="p.tax2.id" />
<input type="hidden" name="tax2value" class="form-control" id="tax2val" ng-model="p.tax2.value" />
<button type="submit" class="form-control btn btn-success" style="margin-top: 10px" ng-click="update(p)">Update</button>
</div>
</div>

Related

AngularJS and ASP.NET MVC data insert issue

I am inserting Data using AngularJS and ASP.NET MVC.
But I am facing issue that the data is inserted null.
What should I do?
This is AngularJS file:
var app = angular.module("myApp", []);
app.controller("myCtrl", function ($scope, $http) {
debugger;
$scope.InsertData = function () {
var Action = document.getElementById("btnSave").getAttribute("value");
if (Action == "Submit") {
$scope.User = {};
$scope.User.Username = $scope.Username;
alert($scope.Username);
$scope.User.Password = $scope.Password;
$scope.User.Email = $scope.Email;
$scope.User.Phone = $scope.Phone;
$scope.User.DOB = $scope.DOB;
$http({
method: "post",
url: "http://localhost:2776/Account/Insert_Employee",
datatype: "json",
data: JSON.stringify($scope.User)
}).then(function (response) {
alert("inserted");
});
}
};
});
This is HTML file:
<div class="tab-content" ng-controller="myCtrl">
<div class="tab-pane active" id="register">
<h3>Register Now !!!</h3>
<p class="text-muted">Be cool and join today. Meet millions</p>
<!--Register Form-->
<form name="registration_form" id='registration_form' class="form-inline">
<div class="row">
<div class="form-group col-xs-6">
<label for="Username" class="sr-only">User Name</label>
<input id="Username" ng-model="Username" class="form-control input-group-lg" type="text" name="Username" title="Enter User name" placeholder="User name" />
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="email" class="sr-only">Email</label>
<input ng-model="Email" id="email" class="form-control input-group-lg" type="text" name="Email" title="Enter Email" placeholder="Your Email" />
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="Phone" class="sr-only">Phone</label>
<input ng-model="Phone" id="Phone" class="form-control input-group-lg" type="text" name="Phone" title="Enter Phone" placeholder="Your Phone" />
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="password" class="sr-only">Password</label>
<input ng-model="Password" id="password" class="form-control input-group-lg" type="password" name="password" title="Enter password" placeholder="Password" />
</div>
</div>
<div class="row">
<p class="birth"><strong>Date of Birth</strong></p>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select class="form-control" id="day">
<option value="Day" disabled selected>Day</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
</div>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select class="form-control" id="month">
<option value="month" ng-model="DOB" disabled selected>Month</option>
<option>Jan</option>
<option>Feb</option>
<option>Mar</option>
<option>Apr</option>
<option>May</option>
<option>Jun</option>
<option>Jul</option>
<option>Aug</option>
<option>Sep</option>
<option>Oct</option>
<option>Nov</option>
<option>Dec</option>
</select>
</div>
<div class="form-group col-sm-6 col-xs-12">
<label for="year" class="sr-only"></label>
<select class="form-control" id="year">
<option value="year" disabled selected>Year</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
<option>2008</option>
<option>2009</option>
<option>2010</option>
<option>2011</option>
<option>2012</option>
</select>
</div>
</div>
<div class="form-group gender">
<label class="radio-inline">
<input type="radio" name="optradio" checked>Male
</label>
<label class="radio-inline">
<input type="radio" name="optradio">Female
</label>
</div>
</form><!--Register Now Form Ends-->
<p>Already have an account?</p>
<button id="btnSave" value="Submit" class="btn btn-primary" ng-click="InsertData()">Register Now</button>
</div>
</div>
This is ASP.NET controller:
public string Insert_Employee(User User)
{
if (User != null)
{
using (Database1Entities Obj = new Database1Entities())
{
Obj.Users.Add(User);
Obj.SaveChanges();
return "Employee Added Successfully";
}
}
else
{
return "Employee Not Inserted! Try Again";
}
}
I am entering data, but data is inserted as null into db. What should I do no?
I have added <body ng-app="myApp">
According to me there is no error
can anyone help?
Try to wrote in this way your ajax call:
$http({
method: "post",
url: "http://localhost:2776/Account/Insert_Employee",
datatype: "json",
data: {user:$scope.User}
}).then(function (response) {
alert("inserted");
});

Not able to pass value in angular function

I am trying to pass expense object to submit function.
But it is not passing entered value
var app = angular.module('addApp', []);
app.controller('addController', function($scope, $http) {
console.log("SAdfasd");
$scope.expense = {param:'',value:0,dt:'',description:''};
$scope.exp = ["One ", "Two", "Three"];
$scope.submit = function(data) {
console.log(data);
console.log($scope.expense);
$http({
method: 'POST',
url: 'added'
data: $scope.expense,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).success(function(data, status, headers, config) {
console.log(data);
}).error(function(data, status, header, config) {
console.log(data);
}
});
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.6/angular.min.js"></script>
<div class="col-lg-8 col-md-8" ng-app="addApp" ng-controller="addController">
<form id="addExpense" name="expenseForm" method="post">
<div>
<label>Expense Type</label>
<select ng-model="expense.param" ng-options="x for x in exp" class="form-control"></select>
</div>
<div>
<label>Amount</label>
<input type="text" name="value" class="form-control" ng-bind="expense.value" placeholder="Enter your expense amount" />
</div>
<div>
<label>Date</label>
<input type="date" name="dt" class="form-control" ng-bind="expense.dt" placeholder="Select expense date" />
</div>
<div>
<label>Description</label>
<textarea rows="4" cols="50" name="description" ng-bind="expense.description" class="form-control" placeholder="Enter your expense description"></textarea>
</div>
<div>
<button type="submit" class="btn btn-success form-control" ng-click="submit(expense)">Save</button>
</form>
</div>
You are using NgBind instead of that it should be NgModel :
var app = angular.module('addApp', []);
app.controller('addController', function($scope, $http) {
$scope.expense=
{param:'',value:0,dt:'',description:''};
$scope.exp = ["One ", "Two", "Three"];
$scope.submit = function() {
//console.log(object);
console.log($scope.expense);
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.6/angular.min.js"></script>
<div class="col-lg-8 col-md-8" ng-app="addApp" ng-controller="addController">
<form id="addExpense" name="expenseForm" method="post">
<div>
<label>Expense Type</label>
<select ng-model="expense.param" ng-options="x for x in exp" class="form-control"></select>
</div>
<div>
<label>Amount</label>
<input type="text" name="value" class="form-control" ng-model="expense.value" placeholder="Enter your expense amount" />
</div>
<div>
<label>Date</label>
<input type="date" name="dt" class="form-control" ng-model="expense.dt" placeholder="Select expense date" />
</div>
<div>
<label>Description</label>
<textarea rows="4" cols="50" name="description" ng-model="expense.description" class="form-control" placeholder="Enter your expense description"></textarea>
</div>
<div>
<button type="submit" class="btn btn-success form-control" ng-click="submit(expense)">Save</button>
</form>
</div>
You are sending JSON obejct to your action but it is expecting it in a Url Params. You can refer your query from here ParamSerializer.
So angular provide $httpParamSerializerJQLike service since 1.4.1
$http({
url: 'added',
method: 'POST',
data: $httpParamSerializerJQLike(data), // Make sure to inject the
service in to the controller
headers: {
'Content-Type': 'application/x-www-form-urlencoded' // header
}
}).then(function(response) { /* do something here */ });
Second way to do -
$http({
url: 'added',
method: 'POST',
data: 'param='+$scope.expense.param+'&value='+$scope.expense.value+'& dt='+$scope.expense.dt+ '& description='+$scope.expense.description OR 'param='+encodeURIComponent($scope.expense.param)+'&value='+encodeURIComponent$scope.expense.value)+'& dt=+encodeURIComponent$scope.expense.dt)+ '& description='+encodeURIComponent$scope.expense.description)
service in to the controller
headers: {
'Content-Type': 'application/x-www-form-urlencoded' // header
}
}).then(function(response) { /* do something here */ });
Please check the syntax's for comma i might have missed .

null value passed from angularjs frontend to jersey backend

i am using angular front end and java jersey as back end .when i submit data from the form ,null values are passed instead of the actual form data. This is my form
<div id="main">
<h1>Create Leave</h1>
<form class="form-horizontal" >
<div class="form-group">
<label for="employeeName" class="col-sm-3 control-label">Employee Name</label>
<div class="col-sm-6">
<input type="text" id="num" class="form-control" ng-model="num" />
</div>
<div class="col-sm-3"></div>
</div>
<div class="form-group">
<label for="leaveType" class="col-sm-3 control-label">Leave Type</label>
<div class="col-sm-2">
<select id="leaveType" class="form-control" ng-model="leaveType">
<option value="hospital">Hospital</option>
<option value="l1">leave type 2</option>
<option value="l2">leave type 3</option>
<option value="l3">leave type 4</option>
<option value="l4">leave type 5</option>
<option value="l5">leave type 6</option>
</select>
</div>
<div class="col-sm-7"></div>
</div>
<div class="form-group">
<label for="leaveStartDate" class="col-sm-3 control-label">Leave Start Date</label>
<div class="col-sm-2">
<input type="date" id="startDate" class="form-control" ng-model="startDate" />
</div>
<div class="col-sm-7"></div>
</div>
<div class="form-group">
<label for="leaveEndDate" class="col-sm-3 control-label">Leave End Date</label>
<div class="col-sm-2">
<input type="date" id="endDate" class="form-control" ng-model="endDate" />
</div>
<div class="col-sm-7"></div>
</div>
<div class="form-group">
<div class="col-sm-3"></div>
<div class="col-sm-2">
<span><b>Is Half Day leave</b></span>
<div class="radio">
<label><input value="Yes" type="radio" name="halfDay" ng-model="isHalfDay" />Yes</label>
</div>
<div class="radio">
<label><input value="No" type="radio" name="halfDay" ng-model="isHalfDay" />No</label>
</div>
</div>
</div>
<button ng-click="add()" class="btn btn-primary">Submit</button>
<button ng-click="resetForm()" class="btn">Reset</button>
</form>
and this is the controller
app.controller("MyAddController", function($scope, $http) {
//$scope.test = {};
$scope.add = function() {
// console.log("------------>"+JSON.stringify($scope.test));
$http.post("webapi/blog/create", {
params: {
signum: $scope.num,
leaveType: $scope.leaveType,
startDate: $scope.startDate,
endDate: $scope.endDate,
isHalfDay: $scope.isHalfDay
}
}).success(function(data, status, headers, config) {
if (data) {
$scope.data = data;
alert("success");
}
}).error(function(data, status, headers, config) {
alert("error");
})
}
});
and the jersey code
#POST
#Path("create")
#Produces({ "application/json" })
public String create(#BeanParam LeaveDetails ld) {
System.out.println("Entered here");
System.out.println(ld.getIsHalfDay());
System.out.println(ld.getNum());
System.out.println(ld.getEndDate());
System.out.println(ld.getStartdate());
System.out.println(ld.getLeaveType());
new AddLeaveDao().addDetails(ld);
System.out.println("Returned here");
return "{}";
}
Please help

Add a custom validation using Angular Auto Validate

First, I'm using Angular Auto Validate and it's working as expected, but I want to add a custom validation to compare passwords.
Here's my code actually:
<form role="form" name="changePasswordForm" novalidate="novalidate" ng-submit="changePassword()">
<div class="box-body">
<div class="form-group">
<label for="oldPassword">Old Password</label>
<input type="password" class="form-control" id="txtOldPassword" name="oldPassword" ng-model="data.oldPassword" placeholder="Old password" required="required" ng-pattern="/^[A-Za-z]+$/" ng-minlength="6" ng-maxlength="10" ng-pattern-err-type="badOldPassword">
</div>
<div class="form-group">
<label for="newPassword">New Password</label>
<input type="password" class="form-control" id="txtNewPassword" name="newPassword" ng-model="data.newPassword" placeholder="New password" required="required" ng-pattern="/^[A-Za-z]+$/" ng-minlength="6" ng-maxlength="10" ng-pattern-err-type="badNewPassword">
</div>
<div class="form-group">
<label for="confirmNewPassword">Confirm New Password</label>
<input type="password" class="form-control" id="txtConfirmNewPassword" name="confirmNewPassword" ng-model="data.confirmNewPassword" placeholder="Confirm new password" required="required" ng-pattern="/^[A-Za-z]+$/" ng-minlength="6" ng-maxlength="10" ng-pattern-err-type="badConfirmNewPassword">
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
var userApp = angular
.module("userModule", ['jcs-autoValidate'])
.run(function(defaultErrorMessageResolver) {
defaultErrorMessageResolver.getErrorMessages().then(function(errorMessages) {
errorMessages['badOldPassword'] = 'Old password must contain only alphabets.';
errorMessages['badNewPassword'] = 'New password must contain only alphabets..';
errorMessages['badConfirmNewPassword'] = 'Confirm password must contain only alphabets.';
})
})
.controller('userController', function($scope, $http, $log) {
$scope.data = {};
$scope.changePassword = function() {
alert('form submitted');
}
});
You should create a directive for this, as below:
angular.module('app', ['jcs-autoValidate'])
.controller('mainCtrl', function($scope) {
})
.directive('confirmPassword', function(defaultErrorMessageResolver) {
defaultErrorMessageResolver.getErrorMessages().then(function(errorMessages) {
errorMessages['confirmPassword'] = 'Please ensure the passwords match.';
});
return {
restrict: 'A',
require: 'ngModel',
scope: {
confirmPassword: '=confirmPassword'
},
link: function(scope, element, attributes, ngModel) {
ngModel.$validators.confirmPassword = function(modelValue) {
return modelValue === scope.confirmPassword;
};
scope.$watch('confirmPassword', function() {
ngModel.$validate();
});
}
};
});
<!DOCTYPE html >
<html ng-app="app">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular.min.js"></script>
<script src="https://cdn.rawgit.com/jonsamwell/angular-auto-validate/master/dist/jcs-auto-validate.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" />
</head>
<body ng-controller="mainCtrl">
<div class="container main-content">
<form novalidate="novalidate">
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password" ng-model="formModel.password" required="" ng-minlength="6" ng-maxlength="12" />
</div>
<div class="form-group">
<label for="exampleInputPassword">Confirm Password</label>
<input type="password" class="form-control" id="passwordConfirm" placeholder="Confirm Password" ng-model="formModel.confirmPassword" required="" ng-minlength="6" ng-maxlength="12" confirm-password="formModel.password" />
</div>
<div class="form-group">
<button class="btn btn-primary" type="submit">Register
</button>
</div>
</form>
</div>
</body>
</html>

ng-file upload not sending file along with other data

i am using angular js frontend along with ng-file module and laravel backend, and for some reason unknown, ng fileupload doesn't send file along with other form data:
here is my form:
<form method="post" name="myForm">
<div class="form-group has-feedback">
<input type="file" ngf-select ng-model="picFile" name="file"
accept="image/*" ngf-max-size="2MB" required
ngf-model-invalid="errorFile">
<i ng-show="myForm.file.$error.required">*required</i><br>
<i ng-show="myForm.file.$error.maxSize">File too large
{{errorFile.size / 1000000|number:1}}MB: max 2M</i>
<img ng-show="myForm.file.$valid" ngf-thumbnail="picFile" class="thumb"> <button ng-click="picFile = null" ng-show="picFile">Remove</button>
</div>
<div class="form-group has-feedback">
<input class="form-control input-lg" id="username" type="text" name="username" ng-model="user.username" placeholder="Name"
required
ng-minlength="6"
autofocus>
</div>
<div class="form-group has-feedback">
<input class="form-control input-lg" type="email" id="email" name="email" ng-model="user.email" placeholder="Email" required>
</div>
<div class="form-group has-feedback">
<input class="form-control input-lg" type="text" id="firstname" name="firstname" ng-model="user.firstname" placeholder="First Name">
</div>
<div class="form-group has-feedback">
<input class="form-control input-lg" type="text" id="lastname" name="lastname" ng-model="user.lastname" placeholder="Last Name">
</div>
<button type="submit" class="btn btn-lg btn-block btn-primary" ng-disabled="!myForm.$valid" ng-click="updateProfile(picFile)" >Update</button>
<span class="progress" ng-show="picFile.progress >= 0">
<div style="width:{{picFile.progress}}%"
ng-bind="picFile.progress + '%'"></div>
</span>
<span ng-show="picFile.result">Upload Successful</span>
<span class="err" ng-show="errorMsg">{{errorMsg}}</span>
{{picFile}}
</form>
and here is my controller:
$scope.getProfile = function() {
Account.getProfile()
.then(function(response) {
$scope.user = response.data;
})
.catch(function(response) {
toastr.error(response.data.message, response.status);
});
};
$scope.updateProfile = function(file) {
file.upload = Upload.upload({
url: '/kilo/api/me',
data: {username: $scope.user.username, file: file },
method:"POST"
});
file.upload.then(function (response) {
$timeout(function () {
file.result = response.data.message;
console.log(file.result);
});
}, function (response) {
if (response.status > 0)
$scope.errorMsg = response.status + ': ' + response.data;
}, function (evt) {
// Math.min is to fix IE which reports 200% sometimes
file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
});
};
the above sends only the "username" and leaves the file. please can anyone show me what am doing wrong?
Add arrayKey: '', headers: { 'Content-Type': undefined }, to your upload object.

Resources