Please sign in to comment.
perf(*): don't trigger digests after enter/leave of structural direct…
…ives ngIf, ngInclude, ngSwitch, and ngView now use the `done` callback functions on animation runners returned by leave/enter animations to do internal cleanup (and $anchorScroll for ngInclude and ngView). Previously, they were using promise callbacks (`then`), which caused an unnessecary digest. Background: In bf0f550, animation promises where introduced instead of animation callbacks. These promises were however not tied to the digest cycle, so you had to manually call `$apply` inside them. This was changed in c8700f0, so animation promise callbacks would always trigger a `$digest`. This meant that several built-in directives would now trigger additional digests on leave (ngIf, ngSwitch) or enter/leave (ngInclude, ngView). The `done` callback, which receives a single argument indicating success / failure was introduced to allow digest-less responses, but wasn't applied to these directives. Note that this applies to all calls to $animate.enter/leave, even if ngAnimate isn't included, and no actual animations are running, because the animation runner code is in the core ng module. Fixes #15322 Closes #15345
- Loading branch information...
Showing with 174 additions and 18 deletions.
- +2 −2 src/ng/directive/ngIf.js
- +7 −6 src/ng/directive/ngInclude.js
- +9 −6 src/ng/directive/ngSwitch.js
- +4 −4 src/ngRoute/directive/ngView.js
- +18 −0 test/ng/directive/ngIfSpec.js
- +29 −0 test/ng/directive/ngIncludeSpec.js
- +71 −0 test/ng/directive/ngSwitchSpec.js
- +34 −0 test/ngRoute/directive/ngViewSpec.js