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: enter image description here

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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -