2

I working on moving some existing angular code from 1.1.5 to 1.2.0-rc.2. Some of the major differences is the use of ngAnimate.

I'm using a combination of ng-if with animate.css in ng-class.

See this plunkr for a working example.

The issue I'm having is that while the fadeIn animation works fine, the element that is supposed to disappear takes close to a second to vanish - there's no smooth transition between the two. This is a simplified example of what I'm actually doing, and I prefer to use ng-if (I realize this example can be simplified with ng-repeat).

Is this an issue with ng-if, or something that has to do with the implementation, animate.css or something else? thanks.

1

1 Answer 1

3

Change your 'hidding' class from ng-hide to fadeOut. fadeOut, like fadeIn is the animate.css way of doing it.

Demo: http://plnkr.co/edit/l0xqnE?p=preview

<div ng-if="showFirst" ng-class="{ 'animated fadeIn' : showFirst, 'fadeOut': !showFirst }">
Sign up to request clarification or add additional context in comments.

2 Comments

There is still an issue with cross fade and your example doesn't work too well for me on Firefox (Linux and OSX), but I guess this stuff comes with the "RC" label. Thanks!
The animations are from CSS, Angular only add/removes classes to trigger the animations. Because browser doesn't support them all the same, there are some differences between the browsers. If you wanted them all to be the same, you should consider JS animations via Angular.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.