-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngIf with ngAnimate adds ng-enter class too late in Safari 9.0.1 #13386
Comments
It doesn't seem do be directly connected to
to
yields the same results. |
This problem seems to be related with issue #12507 in the sense that it applies to the same browsers and was also introduced from 1.4.x versions of angular. I tried your plunker with 1.3.14 and it seems to work fine on Safari 9.0.1. |
I can't confirm it, but it does look similar to issue #12507. |
I forgot to mention this was on Mac OS X, not iOS. |
Sounds also similar to #12969 I've added a new style,
that should make sure the element is hidden before the animation starts. You can also test with these files directly:
|
@eXaminator this is, unfortunately, by design. ngAnimate adds a frame in between the parent ngClass element and the child ngIf. The reason for this is to allow CSS classes to update on the page at the right time in time for the child animations to detect and run properly. There are two ways to work around this:
// app.js
.config(function($animateProvider) {
$animateProvider.classNameFilter(/use-ng-animate/);
}); <div class="outer" ng-class="{'is-open': ctrl.toggle}">
<button ng-click="ctrl.toggle = !ctrl.toggle">Toggle</button>
<div ng-if="ctrl.toggle" class="expandable use-ng-animate">
<div class="content">some content</div>
</div>
</div> NgAnimate in Angular 2.0 will be doing a different approach. We will also work to get that behavior into future versions of 1.x. Closing for now. Please reopen if there is still something that hasn't been covered. |
Awesome, this fixed the issue I was having in safari |
Hi,
I just stumbled across a strange behavior in ngAnimate.
I have build a very simple "collapsible" which removes an element via
ng-if
and animates itsmax-height
on enter and leave. This works as expected unless I also add anng-class
to a parent which sets theis-open
class when the collapsible was opened which also has an animation.When viewing the plunker in Safari (I have 9.0.1) you will see a very short "flicker". It seems that
ng-if
appends the DOM element before the class is set.
Here is a short gif where you can see the problem. When clicking the toggle button it will shortly show the element at full height before collapsing it to
max-height: 0
(as per theng-enter
class) and then it starts growing again with the animation.As soon as you remove the
ng-class
the flicker problem is resolved. This problem doesn't seem to occur in other browsers (at least not in chrome).http://plnkr.co/edit/yrebsEs80kPaS90rk0oE
The text was updated successfully, but these errors were encountered: