Michael Michael - 1 year ago 89
AngularJS Question

How to send POST in angularjs with multiple params?

I want to send multiple parameters using angularjs HTTP post service.

Here is client side code:

$http.post("http://localhost:53263/api/Products/", [$scope.product, $scope.product2]).
then(function (data, status, headers, config) { alert("success") },
function (data, status, headers, config) { alert("error") });

Here is server side code:

// POST api/<controller>
public void Post([FromBody]Product product,[FromBody]Product product2)
var productRepository = new ProductRepository();
var newProduct = productRepository.Save(product);

But when I make the post I get error.
Any idea what I am doing wrong?

Answer Source
 var Indata = {param:'val1',.....}
    url: "time.php",
    method: "POST",
    params: Indata
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download