Error: [$rootScope:infdig] 10 $digest() iterations reached

Just a wild guess as I am not familiar with Ionic.

I am getting the following error sporadically, and this disappears after so many refreshes…

How can i get rid of this?

Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [[“fn: $locationWatch; newVal: 8; oldVal: 7”],[“fn: $locationWatch; newVal: 9; oldVal: 8”],["fn: $locationWatch; newVal: 10; old……5D

Never mind.

I upgraded to latest 1.0.0-beta3 and this seems to go away…

I will reply to this ticket again if I run into the same issue.

So far, looks okay to me…

I am sorry, but this is still happening… :frowning:

This is a problem with how you are using Angular, try googling the first line of your error.

Well, the problem is, that is the first line in the error…

And this only happens when I made some changes and redeploy…

Disappears after so many refreshes in browser, but much harder to refresh in android phone.

Another thing I notice is…

If ion-content doesn’t change, clicking on the menu doesn’t trigger anything…

For example, my side menu looks like this…

<ion-content class="has-header">
    <ion-list>
        <ion-item nav-clear href="">Processes</ion-item>
        <ion-item nav-clear menu-close href="#/app/process/{{process.name}}?global={{process.global}}" padding="true" ng-repeat="process in processes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{process.title}}</ion-item>
    </ion-list>
</ion-content>

When I click those ion-item, I want to make a call (refresh) the ion-content regardless of the change.

It doesn’t seem to be doing it… I don’t know if this is caused by same issue that I reported here… or a feature or ??

Any help is greatly appreciated.

I feel like I am the only one writing to this… but any how…

I noticed some patterns…

Whenever this occurs…

GET http://localhost:8080/solution/iohandheld/cordova.js 404 (Not Found) index.html:23
2
Consider using 'dppx' units instead of 'dpi', as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: not all, (-webkit-min-device-pixel-ratio: 1.5), not all, (min-resolution: 144dpi), (min-resolution: 1.5dppx) 
TypeError: Cannot read property 'name' of null
    at http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:43134:79
    at nodeLinkFn (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18906:13)
    at compositeLinkFn (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18312:15)
    at nodeLinkFn (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18900:24)
    at compositeLinkFn (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18316:15)
    at publicLinkFn (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18221:30)
    at boundTranscludeFn (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18335:21)
    at controllersBoundTransclude [as $transclude] (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18927:18)
    at ngDirective.link (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:32771:16)
    at nodeLinkFn (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:18906:13) <ion-nav-view name="menuContent" animation="slide-left-right"> 

The reported issue occurs…

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: $locationWatch; newVal: 8; oldVal: 7"],["fn: $locationWatch; newVal: 9; oldVal: 8"],["fn: $locationWatch; newVal: 10; oldVal: 9"],["fn: $locationWatch; newVal: 11; oldVal: 10"],["fn: $locationWatch; newVal: 12; oldVal: 11"]]
http://errors.angularjs.org/1.2.12/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3…2fn%3A%20%24locationWatch%3B%20newVal%3A%2012%3B%20oldVal%3A%2011%22%5D%5D
    at http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:12754:12
    at Scope.$digest (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:24545:19)
    at Scope.$apply (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:24759:24)
    at http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:26294:36
    at completeOutstandingRequest (http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:16787:10)
    at http://localhost:8080/solution/iohandheld/lib/ionic/js/ionic.bundle.js:17094:7 ionic.bundle.js:22111
Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: $locationWatch; newVal: 8; oldVal: 7"],["fn: $locationWatch; newVal: 9; oldVal: 8"],["fn: $locationWatch; newVal: 10; old...<omitted>...5D 

This above error happens when I try to show the side menu, as well as when the content on the right side is requested.

Added following three files that make up the entire project so far…

process.html

<ion-view title="{{processName}}">
    <ion-content class="has-header" pdk-next-input-on-enter>
        <div ng-repeat="row in rows" class="row">
            <div ng-repeat="content in row.widgets" class="col col-{{content.percentage}}">
                <div ng-switch on="content.type">
                    <div ng-switch-when="label">
                        <div class="input-label" style="white-space: nowrap;color: {{content.foreColor}}">{{content.value}}</div>
                    </div>
                    <div ng-switch-when="text" class="list">
                        <label class="item item-input"> <!-- style="padding: 0px 0 0px 0px;" -->
                            <span class="input-label">{{content.label}}</span>

                            <div ng-switch on="content.tabOrder" style="width:{{content.percentage}}%">
                                <div ng-switch-when="1">
                                    <input type="text" name="{{content.name}}" placeholder="{{content.toolTip}}" ng-value="{{content.value}}" tabindex="{{content.tabOrder}}" autofocus
                                           ng-model="content.value" ng-blur="onTextBlur(content.name, content.value)">
                                </div>
                                <div ng-switch-default>
                                    <input type="text" name="{{content.name}}" placeholder="{{content.toolTip}}" ng-value="{{content.value}}" tabindex="{{content.tabOrder}}"
                                           ng-model="content.value" ng-blur="onTextBlur(content.name, content.value)">
                                </div>
                            </div>
                        </label>
                    </div>
                    <div ng-switch-when="combobox" class="list">
                        <label class="item item-input item-select">
                            <div class="input-label">
                                {{content.label}}
                            </div>
                            <select name="{{content.name}}" ng-model="content.list" ng-options="option.value as option.name for option in content.params"
                                    ng-change="onListChange(content.name, content.list)">
                            </select>
                        </label>
                    </div>
                    <div ng-switch-when="listbox">
                        <ion-scroll style="height: 180px" style="padding-top: 0px">
                            <label class="item item-radio" ng-repeat="param in content.params" style="height: 35px;font-size: 14px;">
                                <input type="radio" name="{{content.name}}">
                                <div class="item-content">
                                    {{param.value}}
                                </div>
                                <i class="radio-icon ion-checkmark"></i>
                            </label>
                            <!--<table border="1">-->
                                <!--<tr ng-repeat="param in content.params">-->
                                    <!--<td>{{param.value}}</td>-->
                                <!--</tr>-->
                            <!--</table>-->
                        </ion-scroll>
                        <!--<select name="{{content.name}}" ng-model="content.list" ng-options="option.value as option.name for option in content.params"-->
                        <!--ng-change="onListChange(content.name, content.list)" size="7" class="col col-{{content.percentage}}" style="white-space: nowrap;">-->
                        <!--</select>-->
                    </div>
                </div>
            </div>
        </div>
        <div class="row" ng-show="messageRow">
            <div class="col">
                <p ng-repeat="message in messageRow.widgets" style="color:red">{{message.value}}</p>
            </div>
        </div>
    </ion-content>
    <footer class="bar bar-footer bar-stable" style="height:50px">
        <div class="button-bar">
            <a class="button" ng-repeat="content in bottomRow.widgets" ng-click="submit(content)" style="padding-top:2px;color:{{content.foreColor}};background: {{content.backColor}}">{{content.value}}</a>
        </div>
    </footer>
</ion-view>

app.js

angular.module('starter', [
'ionic',
'starter.controllers',
'ngResource'

])

.run(function ($ionicPlatform) {
    $ionicPlatform.ready(function () {
        if (window.StatusBar) {
            // org.apache.cordova.statusbar required
            StatusBar.styleDefault();
        }
    });
})

.directive('pdkNextInputOnEnter', function (ProcessService) {
    var includeTags = ['INPUT', 'SELECT'];

    function link(scope, element, attrs) {
        element.on('keydown', function (e) {
            // Go to next form element on enter and only for included tags
            if (e.keyCode == 13 && includeTags.indexOf(e.target.tagName) != -1) {
                // Find all form elements that can receive focus
                var focusable = element[0].querySelectorAll('input'); //,select,button
                // Get the index of the currently focused element
                var currentIndex = Array.prototype.indexOf.call(focusable, e.target)
                // Find the next items in the list
                var nextIndex = currentIndex == focusable.length - 1 ? 0 : currentIndex + 1;

                if (focusable[currentIndex]) {
                    scope.$parent.request[focusable[currentIndex].name] = focusable[currentIndex].value;
                }
                // Focus the next element
                if (nextIndex >= 0 && nextIndex < focusable.length) {
                    focusable[nextIndex].focus();
                }

                if (focusable[currentIndex]) {
                    var keyName = focusable[currentIndex].name;
                    if (keyName in scope.inputWidgets) {
                        var widget = scope.inputWidgets[keyName];

                        for (var i = 0; i < widget.params.length; i++) {
                            var param = widget.params[i];

                            scope.$parent.request[param.name] = param.value;
                        }

                        scope.$parent.request['processName'] = scope.processName;

                        ProcessService.continue(scope.$parent.request, function (process) {
                            if (process) {
                                scope.$parent.processName = process.processName;
                                scope.$parent.rows = process.rows;
                                scope.$parent.bottomRow = process.bottomRow;
                                scope.$parent.messageRow = process.messageRow;

                                scope.$parent.request = {};
                                scope.$parent.inputWidgets = {};

                                // if the size is one, then add to the request automatically
                                for (var i = 0; i < process.rows.length; i++) {
                                    var row = process.rows[i];
                                    if (row.widgets) {
                                        for (var j = 0; j < row.widgets.length; j++) {
                                            var widget = row.widgets[j];
                                            if (widget.type == 'combobox' || widget.type == 'listbox') {
                                                if (widget.params && widget.params.length > 0) {
                                                    widget.list = widget.params[0].value;
                                                    scope.$parent.request[widget.name] = widget.params[0].value;
                                                }
                                            }
                                            else if (widget.type == 'text') {
                                                if (widget.params && widget.params.length > 0) {
                                                    scope.$parent.inputWidgets[widget.name] = widget;
                                                }

                                                if (widget.value) {
                                                    scope.$parent.request[widget.name] = widget.value;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        });
                    }
                }

                return false;
            }
        });
    }

    return {
        restrict: 'A',
        link: link
    };
})

.config(function ($stateProvider, $urlRouterProvider) {
    $stateProvider
        .state('app', {
            url: "/app",
            abstract: true,
            templateUrl: "templates/menu.html",
            controller: 'AppCtrl'
        })
        .state('app.process', {
            url: "/process/:processName",
            views: {
                'menuContent': {
                    controller: 'ProcessCtrl',
                    templateUrl: "templates/process.html"
                }
            }
        })
        .state('app.tasks', {
            url: "/tasks",
            views: {
                'menuContent': {
                    templateUrl: "templates/tasks.html",
                    controller: 'TaskListCtrl'
                }
            }
        });
    // if none of the above states are matched, use this as the fallback
    $urlRouterProvider.otherwise('/app/tasks');
})

.factory('ProcessService', function ($resource) {
    return $resource('', {}, {
        query: {
            url: 'http://10.1.1.34:8080/solution/resources/handheld',
            method: 'GET',
            isArray: false,
            params: {
                sessionKey: 'SBI|support|5471044a-d3b3-4927-9ef6-500b32b05637',
                processName: '',
                action: 'startProcess',
                platform: 'ionic',
                screenname: 'UserMainMenu'
            }
        },
        continue: {
            url: 'http://10.1.1.34:8080/solution/resources/handheld',
            method: 'GET',
            isArray: false,
            params: {
                sessionKey: 'SBI|support|5471044a-d3b3-4927-9ef6-500b32b05637',
                action: 'continueProcess',
                platform: 'ionic',
                ProcessInstance: '',
                transition: '',
                screenname: 'UserMainMenu'
            }
        }
    });
}

);

controller.js

angular.module('starter.controllers', [])
.controller('AppCtrl', function ($scope) {
    $scope.processes = [
        {
            "title": "Receiving",
            "name": "GeneralReceiving",
            "global": true
        },
        {
            "title": "Picking",
            "name": "SingleScanPicking",
            "global": true
        }
    ];
})

.controller('TaskListCtrl', function ($scope) {
    $scope.playlists = [
        { title: 'Receiving', id: 1 },
        { title: 'Pick by Task', id: 2 },
        { title: 'Replenishment', id: 3 },
        { title: 'Cycle Count', id: 4 }
    ];
})

.controller('ProcessCtrl', function ($scope, $stateParams, $location, ProcessService) {
    ProcessService.query({processName: $stateParams.processName}, function (process) {
        if (process) {
            $scope.processName = process.processName;
            $scope.rows = process.rows;
            $scope.bottomRow = process.bottomRow;
            $scope.messageRow = process.messageRow;

            $scope.request = {};
            $scope.inputWidgets = {};

            // if the size is one, then add to the request automatically
            for (var i = 0; i < process.rows.length; i++) {
                var row = process.rows[i];
                if (row.widgets) {
                    for (var j = 0; j < row.widgets.length; j++) {
                        var widget = row.widgets[j];
                        if (widget.type == 'combobox' || widget.type == 'listbox') {
                            if (widget.params && widget.params.length > 0) {
                                widget.list = widget.params[0].value;
                                $scope.request[widget.name] = widget.params[0].value;
                            }
                        }
                        else if (widget.type == 'text') {
                            if (widget.params && widget.params.length > 0) {
                                $scope.inputWidgets[widget.name] = widget;
                            }

                            if (widget.value) {
                                $scope.request[widget.name] = widget.value;
                            }
                        }
                    }
                }
            }
        }
    });

    $scope.onTextBlur = function(name, value) {
        $scope.request[name] = value;

        console.log($scope.request);
    };

    $scope.onListChange = function (name, value) {
        $scope.request[name] = value;
    };

    $scope.submit = function(widget) {
        for (var i = 0; i < widget.params.length; i++) {
            var param = widget.params[i];

            $scope.request[param.name] = param.value;
        }

        $scope.request['processName'] = $scope.processName;

        console.log($scope.request);

        ProcessService.continue($scope.request, function (process) {
            if (process) {
                if ("UserMainMenu" == process.processName) {
                    $location.path( "/" );
                }
                else {
                    $scope.processName = process.processName;
                    $scope.rows = process.rows;
                    $scope.bottomRow = process.bottomRow;
                    $scope.messageRow = process.messageRow;

                    $scope.request = {};
                    $scope.inputWidgets = {};

                    // if the size is one, then add to the request automatically
                    for (var i = 0; i < process.rows.length; i++) {
                        var row = process.rows[i];
                        if (row.widgets) {
                            for (var j = 0; j < row.widgets.length; j++) {
                                var widget = row.widgets[j];
                                if (widget.type == 'combobox' || widget.type == 'listbox') {
                                    if (widget.params && widget.params.length > 0) {
                                        widget.list = widget.params[0].value;
                                        $scope.request[widget.name] = widget.params[0].value;
                                    }
                                }
                                else if (widget.type == 'text') {
                                    if (widget.params && widget.params.length > 0) {
                                        $scope.inputWidgets[widget.name] = widget;
                                    }

                                    if (widget.value) {
                                        $scope.request[widget.name] = widget.value;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        });
    };

    $scope.foo = function() {
        console.log("FOO");
    }
}

);

menu.html

<ion-side-menus>
<ion-pane ion-side-menu-content>
    <ion-nav-bar class="bar-stable">
        <!--<ion-nav-back-button class="button-clear"><i class="icon ion-chevron-left"></i> Back</ion-nav-back-button>-->
    </ion-nav-bar>
    <ion-nav-view name="menuContent" animation="slide-left-right"></ion-nav-view>
</ion-pane>
<ion-side-menu side="left">
    <header class="bar bar-header bar-stable">
        <h1 class="title">Main</h1>
    </header>
    <ion-content class="has-header">
        <ion-list>
            <ion-item nav-clear href="">Processes</ion-item>
            <ion-item nav-clear menu-close href="#/app/process/{{process.name}}?global={{process.global}}" ng-repeat="process in processes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{process.title}}</ion-item>
        </ion-list>
    </ion-content>
    <footer class="bar bar-footer bar-stable">
        <ion-content>
            <div class="list">
                <label class="item item-input item-select">
                    <div class="input-label">
                        Assigned Zone
                    </div>
                    <select>
                        <option>Zone1</option>
                        <option>Zone2</option>
                    </select>
                </label>
            </div>
        </ion-content>
    </footer>
</ion-side-menu>

That’s all the files that were created, modified, along with corresponding scripts…

I am totally stuck on this, and any HELP is greatly appreciated…

Thanks!

Video demonstration of what’s happening…

Anything I can do to help you guys debug this? I can supply the source code, deploy to public internet… Whatever it takes…

Bump.

Any help is appreciated.

I was using search engine trying to solve my issue and found a solution to mine problem: http://stackoverflow.com/questions/13853844/angular-js-ie-error-10-digest-iterations-reached-aborting#comment37103706_23915946

From StackOverflow experience: try to isolate the issue and provide runnable plnkr / codepen / jsfiddle / jsbin (whatever works for you)

(sorry I cannot help you more)

The error only appears in firefox, right? I think it has to do with this AngularJS Bug: https://github.com/angular/angular.js/issues/7171

In my case the problem was that the generated in menu URL does not match any state.

I have been getting the same issue. There seems to be some documentation about this here: https://docs.angularjs.org/error/$rootScope/infdig

Try To Create a new project and add plat forms and then copy the www folder to the current project and run it may work …happened in my case…Gud Luck

I tried this & it worked

i was using ng-repeat directly on the variable, instead try setting

$scope.xyz = yourObject;

and use xyz in ng-repeat , it worked for me

example :

{{item}}