Search code examples
javascriptangularjsasp.net-web-apidevextreme

dxDataGrid trigger infinite call on web api of all type with ngResource (Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!)


I'm using a dxDataGrid to display some data using our WebApi (MVC .net). On our server the GET function trigger correctly the first time and then everything goes chaos. The server get infinite call on POST,DELETE,GET even if there is no call at all in the request controller on POST,DELETE. Something is clearly looping as you can see on the image below with the error

[$rootScope:infdig] 10 $digest() iterations reached. Aborting!

Angular Problem

Request Controller js code :

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"
            }
        };

    }]);

Request Service js code :

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

Solution

  • AngularJS wrap json object with some custom function request like $get,$post,$delete. It's seem the dxDataGrid trigger them while displaying the "content".

    To fix this, i used the $http beside of resources.