Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animations not trigerred in production env #6

Closed
grabbou opened this issue Dec 17, 2014 · 4 comments
Closed

Animations not trigerred in production env #6

grabbou opened this issue Dec 17, 2014 · 4 comments

Comments

@grabbou
Copy link

grabbou commented Dec 17, 2014

Hi, Thanks for amazing plugin, works flawlessly. Unfortunatelly, my animations are not triggering on first initial load when app is compiled into one file. I've noticed that if app loads too fast then the animations are skipped. Do you have any ideas?

@homerjam
Copy link
Owner

Actually I think thats desired behaviour - but its strange that its working differently per environment. My guess that some delay in the dev environment (loading, bootstrapping etc) is causing the transitions to be triggered mistakenly.

To resolve your problem I would suggest manually triggering the initial transition, or perhaps transitioning to/from a blank state/view.

@grabbou
Copy link
Author

grabbou commented Dec 17, 2014

@homerjam thanks for quick response. Actually, I think it's due to desired behaviour of Angular -> angular/angular.js#5130. Fortunately there's a quick fix (monkey patch but worth giving a go) that does the trick.

It turns out that digest cycle runs somehow when dependencies and app files are separate (~70 GET reuests in the background) which is no long a case in production environment when everything is located inside one file.

@homerjam
Copy link
Owner

Ah, interesting - I've never come across that myself. I'll add a note in the readme. Thanks

@grabbou
Copy link
Author

grabbou commented Dec 17, 2014

No worries, thanks again! It's quite funny that they did that to disable first-load animations, but it's probably because they didn't want e.g. ng-repeat to animate on load (as it has no elements so enter animation is useless).

As you can see from the message above, they monkey patch $rootElement with animation attribute.

Actually, we might create another directive attribute animate-on-load="true" and try to set $element.data('$$ngAnimateState').running = false; instead of changing $rootElement behaviour by default, so maybe somehow it will work for selected elements only (e.g. animate left sidebar on page load with anim-in animations specified but right sidebar should animate only after digests run). That might work better if one have other animations inside container (ng-repeat for instance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants