Answer the question
In order to leave comments, you need to log in
How to generate JSON in AngularJS?
var app1 = angular.module('myApp1', []);
app1.controller('myCtrl1', function($scope, $http) {
$scope.employees = [];
$scope.employeeForm = {
empId: 1,
empPoint: 1001,
empName: "lolik"
};
$scope.sendData = function () {
var method = "";
var url = "";
method = "POST";
url = '/userAdd';
$scope.employeeForm.empId+4;
console.log("POST");
$http({
method: method,
url: url,
data: angular.toJson($scope.employeeForm),
headers: {
'Content-Type': 'application/json'
}
}).then();
};
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question