You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.
The cause is that Angular's digest loop evaluates expressions at least twice, to check if their output is stable. It clearly isn't in the case of shuffle, but other functions with non-deterministic return values, e.g. pairs(), will also cause Angular to get stuck.
The simple solution is to move any expressions with (intermediate, in the case of filters,) non-deterministic return values to your controller (i.e. out of the template). The workaround for this module that comes to mind is to sort the output of non-deterministic functions that are especially useful in templates (such as pairs()). It incurs a bit of overhead, and will be a less clean mapping to underscore, but it will make this module more usable. Currently, I end up shadowing sorted versions of these functions in my controllers.
It would be nice if Angular could take the entire expression into account (i.e. plus filters), so that this issue would not be caused by expressions that sort their output with filters. Perhaps someone would like to upstream this issue there.
EDIT: the workaround isn't as simple as I stated above. For users of this module, ngRepeat's track by clause may help. A true solution will likely involved modified $watch calls.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
copy-paste of your example:
http://plnkr.co/edit/Rr7WBeiwHbCSeQFZ7l19
The text was updated successfully, but these errors were encountered: