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

ngAnimate causes ngShow to malfunction in certain circumstances #12491

Closed
brianmcd opened this issue Aug 3, 2015 · 5 comments
Closed

ngAnimate causes ngShow to malfunction in certain circumstances #12491

brianmcd opened this issue Aug 3, 2015 · 5 comments

Comments

@brianmcd
Copy link

brianmcd commented Aug 3, 2015

Plunkr: http://plnkr.co/edit/dlBOem

Overview

While upgrading an app from 1.3 to 1.4, I've found that ng-show can show the wrong result when ngAnimate is included on the page. In the Plunkr, the div should be hidden, but it's shown.

Versions: 1.4.0+ (1.4.0-rc.2 is the last version that doesn't have this bug)
Browser/OS: I've tested with Chrome and Firefox on OS X and it's always reproducible in both.

Here's the commit range where I believe the bug was introduced: 0681a54...291d7c4 (between 1.4.0-rc.2 and 1.4.0)

The closest issue I found is #11717, which was fixed, but seems related.

Observations:

If you remove ngAnimate from the module or switch to ng-if, the div is properly hidden.

The ng-show condition relies on 2 variables. The values of the variables are printed to the console in the plunkr, and the progression goes like this:

...
loading: true
results.length: 0

loading: false
results.length: 0

loading: false
results.length: 1
...

The condition for the ng-show is !loading && !results.length. I think that second iteration where loading is false and results.length is 0 is what's throwing things off.

Tagging @matsko since he seems to be the expert in this area.

@matsko
Copy link
Contributor

matsko commented Aug 3, 2015

I'm having a look.

@matsko matsko self-assigned this Aug 3, 2015
@matsko matsko added this to the 1.4.x milestone Aug 3, 2015
@matsko
Copy link
Contributor

matsko commented Aug 3, 2015

There was a big commit over the last few weeks that fixed ngAnimate (32d3cbb) and it looks like your issue may be fixed in it: http://plnkr.co/edit/DRaRsT?p=preview

@matsko
Copy link
Contributor

matsko commented Aug 3, 2015

Keep in mind that there hasn't been a release for a few weeks just yet. 1.4.4 will come out this week and that includes this fix that is present in snapshot.

@brianmcd
Copy link
Author

brianmcd commented Aug 3, 2015

Thanks for such a quick response, @matsko. I dropped the snapshot version into my project, and I can confirm that this issue is fixed now.

@brianmcd brianmcd closed this as completed Aug 3, 2015
@matsko
Copy link
Contributor

matsko commented Aug 3, 2015

Excellent! :)

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

No branches or pull requests

2 participants