html - AngularJS getting error on Post method -
i made restful api in .net .the html created angularjs.
the problem is, when page loads, i'm getting following error:
and "insert" button doesn't work anymore.
this insert script , full html can found @ link:
$scope.insert = function insert() { var data = {"id": 3, "name": $scope.name, "description":$scope.description , "price": $scope.price, "categoryid": $scope.categoryid}; $http.post( 'http://localhost:22258/api/product', json.stringify(data), { headers: { 'content-type': 'application/json' } } ).success(function (data) { $scope.products.push(data); });
https://jsfiddle.net/0xb2nh9o/
if kind me make edit button works following model: https://jsfiddle.net/benfosterdev/uwlfj/ make httpput api, wonderful.
all restful requests works, api works, tested postman
i'm kinnda newbie angularjs useful me. lot !
your insert function part of 'productcontroller', not 'formctrl'.
so in html, this:
<div ng-controller="productcontroller">
and rid of error.
Comments
Post a Comment