C
C
coderisimo2016-01-14 12:07:33
Angular
coderisimo, 2016-01-14 12:07:33

How to change number of $digest iterations in Angular?

I have a tree view editor. There are not a few elements, the nesting is decent. Error pops up intermittently

Error: [$rootScope:infdig] angularjs/1.3.20/$rootScope/infdig?p0=10&p1

I read that you can avoid it by increasing digestTtl .
I try like this:
angular.module('App',[] ,function($rootScopeProvider) {$rootScopeProvider.digestTtl(15);})
            .controller('EditorCtrl', ['$scope', 'fileUpload', '$http', 'iddirector', function ($scope, fileUpload, $http, iddirector) {

//controller content

In response, the application does not start. Tell me how to defeat this.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nicholas, 2016-01-14
@coderisimo

I understand that you need to call it in the config block.
Something like this:

angular.module('App',[])
.config(['$rootScopeProvider', function($rootScopeProvider) { $rootScopeProvider.digestTtl(15); } ])
.controller( ... );

PS
Don't do that, tree menus are almost always a design anti-pattern.

K
Kostya Gorozhanov, 2016-01-14
@kgorozhanov

plnkr.co/edit/Zn7UnGlfCqm49lsf9oqW?p=preview

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question