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 was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ngMessages(ngAnimate 1.4.5?): Flash of content before animation begins. #12969
I just noticed a bug which I thought was in Angular Material, but I now believe is in Angular itself.
When the animation for my ng-messages begins, there is a flash where you can see all messages before the animation begins. Although the issue is appearing with ngMessages, I think it might be a broader $animate issue because I can reproduce this by upgrading only angular.js and angular-animate.js from 1.4.4 to 1.4.5 (leaving everything else including angular-messages.js at 1.4.4).
Oddly, if I leave either file at 1.4.4 (it doesn't matter which one), the issue is not reproducible, so it seems to be an issue when both files are at version 1.4.5.
Version Introduced: 1.4.5? Versions Tested: 1.4.4 (works here; broken on others), 1.4.5, 1.4.6, 1.5.0-beta.0 Browsers: All (IE Edge, Safari, Chrome/Firefox on both OS X and Windows)
I did not see any relevant breaking changes in the changelog between 1.4.4 and 1.4.6 which would account for this. Please let me know if I can provide any additional information.
It also happens on ngIf in IE and Firefox, but not in Chrome. I've created a JSFiddle that illustrates the difference:
Reproduction
In this fiddle, delete the contents of the input box. http://jsfiddle.net/kvetis/ssnkqog6/3/ Affected Versions: 1.4.5, 1.4.6, 1.4.7 (1.4.4 is okay, probably introduced in 1.4.5) Browsers: Chrome 45 (ngMessages), IE11 (ngMessages, ngIf), FF 39 (ngMessages, ngIf) @ Windows 8.1 home
I encountered this, too. The exit animation is fine, but before the enter animation runs, all ng-messages momentarily display (tested Chrome, FF). Reading through the comments so far, is it correct that there is no known way around this if you're in 1.4.x, except to animate manually?
This does successfully keep the message unshown during the would-be flicker. However you need the :not(.ng-leave) there or else it will also dump your exit animation. Unfortunately I don't think this will help except in cases like mine, where there's only ever one ng-message at a time.
@C-E-Rios, you could replace ngShow with ngIf on the [ng-message] elements (and don't need any -prepare styles). (But from a quick look, yours is a different issue than what is being discussed here.)
Activity
ThomasBurleson commentedon Sep 29, 2015
@robertmesserle - is this related to any changes you may have made ?
@matsko - what are your thoughts here ?
robertmesserle commentedon Sep 29, 2015
@ThomasBurleson If this is an AngularJS issue, then no - I have no commits in the angular.js repo.
matsko commentedon Sep 29, 2015
I see what's going on here. I'll have a look later today.
topherfangio commentedon Sep 29, 2015
I reproduced the demo without material just to make sure it wasn't some weird interaction with our CSS/JS. You can view it below if it's helpful:
https://codepen.io/topherfangio/pen/zvoXjz
@matsko Thanks for taking a look!
kvetis commentedon Oct 2, 2015
It also happens on ngIf in IE and Firefox, but not in Chrome. I've created a JSFiddle that illustrates the difference:
Reproduction
In this fiddle, delete the contents of the input box.
http://jsfiddle.net/kvetis/ssnkqog6/3/
Affected Versions: 1.4.5, 1.4.6, 1.4.7 (1.4.4 is okay, probably introduced in 1.4.5)
Browsers: Chrome 45 (ngMessages), IE11 (ngMessages, ngIf), FF 39 (ngMessages, ngIf) @ Windows 8.1 home
Interesting thing is that if you try the second form on this Angular Material demo page: https://material.angularjs.org/0.11.2/#/demo/material.components.input
The issue does not occur on the Client Name input, but appears on Client Email (I have no theory why.)
26 remaining items
bathos commentedon Feb 14, 2016
I encountered this, too. The exit animation is fine, but before the enter animation runs, all ng-messages momentarily display (tested Chrome, FF). Reading through the comments so far, is it correct that there is no known way around this if you're in 1.4.x, except to animate manually?
Edit: in my case, I was able to solve it in cases where there is only going to ever be one ng-message by adding this:
This does successfully keep the message unshown during the would-be flicker. However you need the :not(.ng-leave) there or else it will also dump your exit animation. Unfortunately I don't think this will help except in cases like mine, where there's only ever one ng-message at a time.
Narretz commentedon Feb 15, 2016
We've decided to backport the ng-[event]-prepare class back to 1.4.x, and it will be available in the upcoming 1.4.10
Narretz commentedon Feb 15, 2016
I'm not sure if we can ever provide a "real" fix, since the animation spacing is so essential to ngAnimate now. Moving to the backlog for now.
jaszczakBartosz commentedon Jul 19, 2016
This worked for me:
topherfangio commentedon Jul 19, 2016
@Unasbj Indeed; this new class was added in more recent versions and allows you to work around this bug.
@Narretz I think this can be closed now?
C-E-Rios commentedon Dec 7, 2016
This is still an issue for me. I've tried some of the workarounds suggested but none work. Maybe I'm missing something?
https://plnkr.co/edit/XYq1wF7la97dIz9Ec33J?p=preview
gkalpak commentedon Dec 7, 2016
@C-E-Rios, you could replace
ngShowwithngIfon the[ng-message]elements (and don't need any-preparestyles).(But from a quick look, yours is a different issue than what is being discussed here.)
C-E-Rios commentedon Dec 7, 2016
@gkalpak - Awesome that does the trick. Thank you.