Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Prevent digest cycle problem on enter/tab #115

Closed
wants to merge 1 commit into from
Closed

Prevent digest cycle problem on enter/tab #115

wants to merge 1 commit into from

Conversation

tikiatua
Copy link

Wrap function calls in the _onKeyDown function in $timeout to prevent problems with the digest cycle after selecting an item using the keyboard (i.e. tab or enter).

Wrap function calls in the _onKeyDown function in $timeout to prevent problems with the digest cycle after selecting an item using the keyboard (i.e. tab or enter).
@dimirc
Copy link
Contributor

dimirc commented Jul 20, 2014

Keep I mind this function is already called inside an $apply so there shouldn't be the need for the $timeout

Did you actually had any problem with the way it is currently?

@tikiatua
Copy link
Author

Yes, I did actually run into the problem. This could have been due to the fact, that I used the directive inside another custom directive that was watching the object used for ngModel and triggered some custom events on any change to the object (sorry this might be a little confusing to understand)

@dimirc
Copy link
Contributor

dimirc commented Jul 20, 2014

Can you setup a simplified Plunker reproducing the issue so I can check it if we can do something at the directive to prevent it?

@tikiatua
Copy link
Author

Sure.. Will try to set one up

@tikiatua
Copy link
Author

Hmm.. I was not able to reproduce the problem in a simple plunker yet.

Actually it does not seem to be a problem with an additional watcher but with the dispatch of a focus() event on the element (line 259: ctrl.focusser[0].focus()), which is handled through jquery (being included in the site for other purposes) and results in a [$rootScope:inprog] error.

The error does not occur, if I set breakpoints in the debugger to track it down further

@dimirc
Copy link
Contributor

dimirc commented Jul 20, 2014

I'd need some code to check this. Try to put together a Plunker with this error or specific instruction how to produce the error so we can check and try to help better.

Sent from my iPhone

On Jul 20, 2014, at 3:42 PM, Ramon Saccilotto [email protected] wrote:

Hmm.. was not able to reproduce the problem in a simple plunker yet.

Actually it does not seem to be a problem with an additional watcher but with the dispatch of a focus() event on the element (line 259: ctrl.focusser[0].focus()), which is handled through jquery (being included in the site for other purposes) and results in a [$rootScope:inprog] error.

The error does not occur, if I set breakpoints in the debugger to track it down further


Reply to this email directly or view it on GitHub.

@dimirc
Copy link
Contributor

dimirc commented Aug 2, 2014

@tikiatua where you using angular v.1.3.0-beta-12+? if that's the case then it will be fixed with #137

@dimirc dimirc closed this Aug 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants