angular-xeditable icon indicating copy to clipboard operation
angular-xeditable copied to clipboard

ng-Table with x-editable e-single is giving 10 $digest() iterations reached. Aborting!

Open Pavan1889 opened this issue 9 years ago • 8 comments

in my form i have table with 2 texts and 3 dropdowns which are editable-select but i have debugged and came to know that beacuse of the function showStatus() which is calling many times. in my case it is executing for 124 times. and finally in console throwing an error "10 $digest() iterations reached. Aborting!" i have forked the original editable-select in my case: http://jsfiddle.net/Pavan1889/q44qfcj8/

[$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [[{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":{"Value":null}},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":{"Value":null}},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":{"Value":null}},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":{"Value":null}}],[{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."},{"msg":"fn: ngModelWatch","newVal":{"Value":null},"oldVal":"..."}]]

Pavan1889 avatar Apr 15 '16 11:04 Pavan1889

What exactly did you change in your JSFiddle? I looked at it and nothing was jumping out at me.

ckosloski avatar Apr 15 '16 16:04 ckosloski

Sorry im not available online from past 2 weeks, any how check the below for issue:

http://jsfiddle.net/Pavan1889/q44qfcj8/1/

Pavan1889 avatar Apr 29 '16 09:04 Pavan1889

Hi i have made one more fiddle resembling my issue :

http://jsfiddle.net/Pavan1889/vraounop/1/

Pavan1889 avatar Apr 29 '16 12:04 Pavan1889

Looking at your latest fiddle, I see several errors in the console relating to ng-table.

Error: pData.then(...).catch is not a function NgTableParams/this.reload@https://cdn.rawgit.com/esvit/ng-table/master/dist/ng-table.js:1101:1

Error: Template must have exactly one root element.

ckosloski avatar Apr 29 '16 12:04 ckosloski

I think your issue is due to normal angular behavior. This {{showStatus()}} creates a watcher and anytime there is a digest, the showStatus function gets called.

I verified this by printing out the stack trace of the call every time it was called:

at Scope.$scope.showStatus ((index):302) at fn (eval at (angular.js:14086), :4:221) at expressionInputWatch (angular.js:15116) at Scope.$digest (angular.js:16655) at Scope.$apply (angular.js:16928) at HTMLAnchorElement. (xeditable.min.js:6) at defaultHandlerWrapper (angular.js:3398) at HTMLAnchorElement.eventHandler (angular.js:3386)

I think what you need to do is do a one way binding on the initial text display and then update the text via a function call with the onaftersave attribute.

Check out this version of your jsfiddle.

ckosloski avatar May 03 '16 21:05 ckosloski

Hi i did the same, but i ended up like this???

http://jsfiddle.net/Pavan1889/q44qfcj8/3/

https://jsfiddle.net/Pavan1889/6a71bu7g/1/

where i am going wrong?

Pavan1889 avatar May 04 '16 12:05 Pavan1889

You need angular version 1.3 or higher. That is when the single way binding was introduced.

ckosloski avatar May 04 '16 13:05 ckosloski

Try with the latest version which contains changes to scope which may fix your issue.

ckosloski avatar Jul 15 '16 16:07 ckosloski