2016-05-31 30 views
0

我正在使用dxDataGrid來顯示一些數據使用我們的WebApi(MVC 。淨)。 在我們的服務器上,GET功能第一次正確觸發,然後 一切都變得混亂。即使POST,DELETE請求控制器中根本沒有任何調用,服務器也會對POST,DELETE,GET進行無限調用。 有些東西顯然是循環的,因爲您可以在下面的圖片中看到錯誤

[$ rootScope:infdig] 10 $ digest()迭代到達。中止!

Angular Problem

請求控制器的js代碼:

angular.module('wdfApp.controllers') 
    .controller('RequestListCtrl', ['$scope', '$http', 'Request', function ($scope, $http, Request) { 

     var customStore = new DevExpress.data.CustomStore({ 
      load: function (loadOptions) { 

       var query = Request.query(); 
       return query.$promise; 
      } 
     }); 


     $scope.dataGridOptions = { 
      dataSource: customStore, 
      remoteOperations:false 
      , 
      loadPanel: { 
       enabled: false 
      }, 
      scrolling: { 
       mode: "virtual" 
      }, 
      sorting: { 
       mode: "none" 
      } 
     }; 

    }]); 

請求服務的js代碼:

angular.module('wdfApp.services') 
.factory('Request', ['$resource', 
    function ($resource) { 
     return $resource('/api/requests/:request'); 
    }]); 

回答

2

AngularJS包裝與像$得到,$後一些自定義的功能要求JSON對象, $刪除。似乎dxDataGrid在顯示「內容」時觸發它們。

爲了解決這個問題,我使用了旁邊的資源$ http。

相關問題