0 votes
in Angular by
How Do We Pass Data using HTTP POST in Angular?

1 Answer

0 votes
by

You need to pass data using the data keyword in the $http service API function. In the below code, you can see that we have created a JavaScript object myData with CustomerName property. This object is passed in the $http function using HTTP POST method.

JavaScript
Var myData = {};
myData.CustomerName = "Test";
$http({ method: "POST",
	data: myData,
	url: "http://www.xyz.com"})
	.success(function (data, status, headers, config)
	{
	  // Here goes code after success
	}

Related questions

0 votes
asked Dec 31, 2023 in Angular by DavidAnderson
0 votes
asked Dec 31, 2023 in Angular by DavidAnderson
...