I am trying to send a repeater array items to web api controller method as parameter. When I click the button containing the function its giving me this error in console and nothing happens.
object is not a function
I guess I'm passing the orders array in a wrong way. How to do that correctly.
My ng-repeat
<table class="table table-bordered table-hover" style="width:800px" data-ng-model="orderProduct">
<tr data-ng-repeat="order in orders">
<td>{{selectedProduct.pname}}</td>
<td>{{order.pid}}</td>
<td>{{order.oid}}</td>
<td>{{order.qty}}</td>
<td>{{order.total}}</td>
</tr>
</table>
<input type="button" data-ng-click="addOrder()" class="btn btn-danger" data-ng-disabled="!orders.length" value="Submit Orders" />
My controller method $scope
$scope.addOrder = function () {
var orders = this.orders;
$http.post('/api/OrderDetails/', orders).success(function (data) {
alert("Added Successfully!!");
$scope.addMode = false;
}).error(function (data) {
$scope.error = "An Error has occured while Adding Order details! " + data;
});
};