-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ng-hide="expression()" not working in 1.3-rc2 (timing issue?) #9147
Comments
Is this related to this: #9103 ? |
Hi @matthiasg thanks for all the detail. It would make it easier to review and experiment with if you could create a plnkr demonstrating the issue. |
Sure that would be great... I started doing that yesterday but I found the plunkr UI confusing to get the new angular library rc2 into it .. So I ran out of time after a 15 hour day coding ;) When nobody reading this suddenly says .. Oh .. Wait.. That's xyz .. Then I will create one next week when I am back in the office... Cheers -----Original Message----- Hi @matthiasg thanks for all the detail. It would make it easier to review and experiment with if you could create a plnkr demonstrating the issue. |
I tried to reproduce it (based on what I understood from the @matthiasg's post), but the issues doesn't appear. Maybe you can modify them to reproduce the problem. Fiddle with (I tried both with and without Maybe it is a timing issue that only appears when the $digest loop takes more time to complete. (/cc @jeffbcross) |
Thanks will try... The Dom is nested deeply in our app. A number of includes ... -----Original Message----- I tried to reproduce it (based on what I understood from the @matthiag's post), but the issues doesn't appear. Maybe you can modify them to reproduce the problem. |
So I forged @gkalpak example a bit. Is this the desired behavior in Angular: http://jsfiddle.net/f5b8o1m5/1/ Edit: updated the link |
@fobin yest thats the setup, but in my case it still shows the line so its not about timing per se it would seem. possible because we have 3 nested templates at that position etc ... when i am back in the office next week i will try to strip out unnecessary bits until i can reproduce more easily. |
@matthiasg regarding loading scripts in plnkr, I usually just add a script tag in the head of the document pointing to code.angularjs.org: <head>
<script src="https://code.angularjs.org/1.3.0-rc.2/angular.js"></script>
</head> |
well this is seemly related with #9222 |
Based on @fobin's reproduction, I think #9283 does fix this http://plnkr.co/edit/rcSRKNSwx782DDsqgMOw?p=preview (we aren't showing elements with ng-hide when the expression evaluates to true) |
Closed by 667183a (???) --- let me know if you have other issues with this |
Verified: It fixes the issues I have been having. Thanks :) |
TLDR:
<p ng-hide="isHidden()"> {{isHidden()}} </p>
shouldnt ever result in<p ng-hide="isHidden()" class="ng-binding"> true </p>
and thus not add classng-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
worksFull:
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:
i get this output:
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()
returnsfalse
at first and then becomestrue
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.The text was updated successfully, but these errors were encountered: