超出 RangeError 最大调用堆栈大小 AngularJS

RangeError maximum call stack size exceeded AngularJS

我是 AngularJS 的新手。 从脚本开始在开发时运行良好,在上传到生产环境后,我的控制器中出现了 RangeError。我对这个错误感到困惑,即使我用 Google 搜索仍然没有解决:(

这是我在 routeProvider 上的脚本:

    .when('/customer/detail/:id', {
    title: 'Customer Detail',        
    templateUrl: 'templates/customer_detail.html',
    resolve: {
        app: function($q, $rootScope, $location, roles) {
            var defer = $q.defer();
            if (roles.pageCustomer !== true) {
                $location.path('/main.html');
            };
            defer.resolve();
            return defer.promise;
        }
    }
})

然后在我的控制器上:

app.controller('ctrl_customer_list', function($scope){

        $scope.title    = "Customer List";


        $('#datatable_customer').DataTable({
            bServerSide: true,
            bDestroy: true,
            responsive: true,
            iDisplayLength: 250,
            serverSide: true,
            columnDefs: [ {
            targets: 0,
            orderable: false,
            targets : 1,
            "render": function ( data, type, row, meta ) {
            var itemID = row[8];                   
            return '<a href="customer/detail/' + itemID + '">' + data + '</a>';
            }                     
        }],
            lengthMenu: [ 10, 25, 50, 75, 100, 250, 500, 1000 ],         
            aaSorting: [[1, 'asc']],
            ajax:{
                    url :"backend/customer/list", // json datasource
                    type: "post",  // type of method  ,GET/POST/DELETE
                    error: function(){
                                        $("#datatable_processing").css("display","none");
                                    }
            },
            language: {
                    searchPlaceholder: 'Search...',
                    sSearch: '',
                    lengthMenu: '_MENU_ items/page',
            }

    });

    $('.dataTables_length select').select2({ minimumResultsForSearch: Infinity });

});

代码生成后出现以下错误:

RangeError: Maximum call stack size exceeded
at Function.n.extend.n.fn.extend (jquery.js:177)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
at Function.n.extend.n.fn.extend (jquery.js:228)
(anonymous) @ angular.js:15536
(anonymous) @ angular.js:11815
(anonymous) @ angular.js:21559
Pg.completeTask @ angular.js:21194
(anonymous) @ angular.js:6790
setTimeout (async)
h.defer @ angular.js:6788
f @ angular.js:21554
(anonymous) @ select2.js:194
(anonymous) @ angular.js:1365
Ba @ angular.js:11235
q @ angular.js:10554
g @ angular.js:9801
g @ angular.js:9804
g @ angular.js:9804
g @ angular.js:9804
g @ angular.js:9804
q @ angular.js:10548
g @ angular.js:9801
g @ angular.js:9804
g @ angular.js:9804
q @ angular.js:10548
g @ angular.js:9801
(anonymous) @ angular.js:9666
link @ angular-route.js:1260
(anonymous) @ angular.js:1365
Ba @ angular.js:11235
q @ angular.js:10554
g @ angular.js:9801
(anonymous) @ angular.js:9666
(anonymous) @ angular.js:10080
d @ angular.js:9844
m @ angular.js:10604
C @ angular-route.js:1209
$broadcast @ angular.js:19683
(anonymous) @ angular-route.js:749
(anonymous) @ angular.js:17914
$digest @ angular.js:19075
$apply @ angular.js:19463
k @ angular.js:13312
w @ angular.js:13569
E.onload @ angular.js:13474
load (async)
(anonymous) @ angular.js:13457
s @ angular.js:13257
(anonymous) @ angular.js:12998
(anonymous) @ angular.js:17914
$digest @ angular.js:19075
$apply @ angular.js:19463
(anonymous) @ angular.js:15270
dispatch @ jquery.js:4435
r.handle @ jquery.js:4121

我正在使用 AngularJS 1.7.5 和 GruntTasker。 有什么建议吗?非常感谢您的帮助 (对不起我的英语)

只需更新即可解决问题。首先,我按照@numbtongue 提到的说明进行操作。终于发现问题出在AngularJS-select2。我试图从存储库中删除 AngularJS-select2 并且终于成功了!

非常感谢@numbtongue 作为指令调试 Chrome。

PS: 使用调试器,您可以看到一次执行了多少个脚本。