Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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

Description

@brianmcd

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions