angularjs - TypeError: Cannot assign to read only property 'method' of 11 -


i'm beginner in angularjs , have problem. use angularjs client side , asp.net c# , web api server side.

i want send object (or string variable) web api controller , collection of record of table. recieve error in browser console:

typeerror: cannot assign read property 'method' of 11.

and code:

angular controller:

$scope.selectedmaincategory = {     maincategorycode: '11',     maincategoryname: 'eleven' }; $scope.getwholedata = function () {     $http.get("http://localhost:35621/api/subcategoryapi", $scope.selectedmaincategory.maincategorycode)         .success(function (response) {          $scope.wholedata = response;      })     .error(function () {         alert("data not found", error);     }); }; 

web api controller:

public ienumerable<sp_subcategory_selectallrecs_result> gettb_subcategory(string mymaincategorycode)     {         return db.sp_subcategory_selectallrecs(mymaincategorycode, "");     } 

('sp_subcategory_selectallrecs' sql server stored procedure , 'sp_subcategory_selectallrecs_result' class result of sp)

where mistake?

try change url. possible solution be:

$scope.getwholedata = function () {   $http.get("http://localhost:35621/api/subcategoryapi?code=" + $scope.selectedmaincategory.maincategorycode)   .success(function(data){     console.log("data:",data);   })   .error(function(err){     console.log("error:",err);   }) } 

then on server can handle code parameter.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -