Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($animate): ensure guarded animations consider AJAX requests upon bootstrap #8540

Closed
wants to merge 2 commits into from

Conversation

matsko
Copy link
Contributor

@matsko matsko commented Aug 8, 2014

Prior to this fix when an Angular application is bootstrapped it would only
place an animation guard to prevent animations from running when the application
starts for the first two digest cycles. However, if any controllers or directives,
that are executed upon boostrap, trigger any remote code to be downloaded (via $http)
then the guard does not put that into consideration. This fix now properly addresses
that circumstance and removes the guard once all outbound HTTP requests are complete
when an Angular application is bootstrapped.

Closes #8275
Closes #5262

}
} else if(val === 0) {
// ...when the template has been downloaded we digest twice again until the
// animations are set to enabled (since enter, leave and move require a follow-up).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to see more inline comments in the ngAnimate code, +1 for adding some.

* No they are not. When an application is bootstrapped Angular will disable animations from running to avoid
* a frenzy of animations from being triggered as soon as the browser has rendered the screen. For this to work,
* Angular will wait for two digest cycles until enabling animations. From there on, any animation-triggering
* layout changes in the application will be handled naturally.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does "naturally" mean here? can you be more specific?

@IgorMinar IgorMinar added this to the 1.3.0 milestone Aug 21, 2014
@IgorMinar IgorMinar modified the milestones: 1.3.0, 1.3.0-beta.20 Aug 25, 2014
@matsko matsko force-pushed the pr_8275 branch 3 times, most recently from 923804d to 3d2f571 Compare August 28, 2014 01:07
matsko added 2 commits August 27, 2014 21:10
This handy service is designed to download and cache template contents
and to throw an error when a template request fails.

BREAKING CHANGE

Angular will now throw a $compile minErr each a template fails to download
for ngView, directives and ngMessage template requests. This changes the former
behavior of silently ignoring failed HTTP requests--or when the template itself
is empty. Please ensure that all directive, ngView and ngMessage code now properly
addresses this scenario. NgInclude is uneffected from this change.
…bootstrap

Prior to this fix when an Angular application is bootstrapped it would only
place an animation guard to prevent animations from running when the application
starts for the first two digest cycles. However, if any controllers or directives,
that are executed upon boostrap, trigger any remote code to be downloaded (via $http)
then the guard does not put that into consideration. This fix now properly addresses
that circumstance and removes the guard once all outbound HTTP requests are complete
when an Angular application is bootstrapped.

Closes angular#8275
Closes angular#5262
@matsko
Copy link
Contributor Author

matsko commented Aug 28, 2014

MERGED

a70e283
4bca4c4

@matsko matsko closed this Aug 28, 2014
@matsko matsko deleted the pr_8275 branch August 28, 2014 03:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animations firing on page load when element within directive template Animation Flicker
4 participants