This is below my code using Web Api with Angularjs. I am facing problem that my add New product is not working.
MyApp.controller('ProductController', function ($scope, $http, $resource) {
Product = $resource('/api/Product')
$scope.Product = Product.query();
$scope.prod = {},
$scope.AddProduct = function (prod) {
var data = prod;
$http.post('/api/Product', JSON.stringify(data), {
headers: {'Content-Type':'application/json'}
}).success(function (data) {
})
}
});
This is my Index.html page
<div style="width:500px;height:150px;margin:0 auto">
<form ng-submit="AddProduct(prod)">
<table>
<tr>
<td>Name</td>
<td>:</td>
<td>
<input type="text" ng-model="prod.Name" />
...
Go to the complete details ...