无法加载资源:服务器响应状态为500

时间:2016-12-02 12:08:13

标签: angularjs

在这里,我使用带有mvc的角度;当我试图发送数据时,我发现上面有错误,而且我得到了一些脚本错误

 $scope.DeleteCustomer = function(list) {  
             var itemList = [];  
             angular.forEach(list, function(value, key) {  
                 if (list[key].selected) {  
                     itemList.push(list[key].selected);  
                 }  
             });  

             $http.post("/Department/GetEmployeeById/" + itemList).success(function (data) {
                 $window.alert(data);  
             }).error(function(msg) {  
                 console.log(msg);  
             });  
         }  

Htmlcode

    <div ng-controller="EmpCtrl">
            <input type="button" class="btn btn-sm btn-primary pull-right" ng-model="isAll" value="GetData" ng-click="BtnClick()">
  <table class="table table-hover table-bordered" ng-show="GetDb.length>0">
                <tr>
                    <th>
                        <input type="checkbox" ng-model="Chk"  />

                    </th>
                    <th>Id</th>
</tr>
                <tr ng-repeat="ee in GetDb">
                    <td><input type="checkbox" id="check1" ng-true-value="{{ee.id}}" ng-false-value="''" ng-model="ee.selected" /></td> 
                    <td>{{ee.id}}</td>

1 个答案:

答案 0 :(得分:1)

 return $http.post("/Department/GetEmployeeById/", itemList).success(function (data) {
          $window.alert(data);
 }).error(function (msg) {
       console.log(msg);
 });

确保已向控制器注入$ window