-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngAnimate doesn't trigger enter method on first page load #10536
Comments
Actually, it is a normal Angular approach that has been introduced a while ago. You can read more about the details here -> #5130. There's a quick 'dirty-hack' mentioned in the last comment there showing how to make that working again. I've recently needed to enable that in order to present enter animation of the whole app to the users. Note: Remember that this is still dirty hack that may stop working in the future or create additional bugs so comment that line really nicely in your app and always check when upgrading to a newer Angular version. |
@matsko - should we make this easier to achieve? @eegl - an alternative less hacky approach is to initialize the things that you want to be animated on start up via a $timeout. See http://plnkr.co/edit/2kRgrYYcJvtbXwNXn9n2?p=preview |
@grabbou , @petebacondarwin thank you both for your suggestions and explaining what's going on! I've ended up with the following code, which - I believe - is hacky too, but I've only needed to add one line, without changing anything else (basically manually triggering the same animation as I have on 'enter'):
|
@petebacondarwin @MatasKo Maybe additional argument when declaring animations with ngAnimate, like "animateOnStartup: {Boolean} | false" by default ? |
from the comments, it is my understanding that there is nothing else to be done for this issue. If there is something else that needs attention, feel free to reopen the issue |
year passed... |
@glebmachine, what news do you expect? Based on the comments, the conclusion was that this is working as expected, there is a way to change the default behavior if you wish and there is nothing more to do. If you are having issues with latest versions, please open a new issue describing the problem (and please reference this issue for context). |
@glebmachine The best way for now is using setTimeout as a workround |
Yeah, looks fair.
I hoped that there is any option to trigger animation on element appear, but it's triggered only on change by design(
|
Using this snippet animations are also played on page load: |
After upgrading to v1.3.8 ngAnimate doesn't trigger enter method on first page load.
I'm using Javascript based animations with the standard Angular Router.
Like:
and I have
<main ng-view class="an-reveal"></main>
The text was updated successfully, but these errors were encountered: