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.

ng-hide="expression()" not working in 1.3-rc2 (timing issue?) #9147

Closed
@matthiasg

Description

@matthiasg

TLDR:
<p ng-hide="isHidden()"> {{isHidden()}} </p> shouldnt ever result in
<p ng-hide="isHidden()" class="ng-binding"> true </p> and thus not add class ng-hide.
Happens when isHidden changes its outcome after initial binding.

Just reverting all angular* files back to 1.3.0-beta.18 solves this.

EDIT: its not ok in rc.1. beta.18 works

Full:

I have just updated our app to 1.3-rc2 for testing and found this little gem in our app.

I would assume $animate addClass or removeClass to have a timing bug.

Given this template in a directive:

<div>
  <p ng-hide="true">THIS IS HIDDEN</p>
  <p ng-hide="isHidden()">isHidden() = {{isHidden()}}</p>
</div>

i get this output:

<div>
  <p ng-hide="true" class="ng-hide">THIS IS HIDDEN</p>
  <p ng-hide="isHidden()" class="ng-binding">isHidden() = true</p>
</div>

Debugging into the ngHideDirective showed that it did indeed correctly triggers the $animate.addClass(element,'ng-hide') call on both elements, but it only actually adds the class on the first paragraph.

This happens when isHidden() returns false at first and then becomes true a little later (a scope.$watch in our case).

Its the same way the other way around. Then isHidden() returns true from the outset it does indeed hide it, but then the change to false is not respected.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions