Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to prevent animation from running on element that is initially hidden?
    primarykey
    data
    text
    <p>My question is similar to <a href="https://stackoverflow.com/questions/16158021/prevent-angularjs-animation-from-running-on-element-that-is-initially-hidden-whe">this one</a> and <a href="https://stackoverflow.com/questions/15839479/nganimate-on-ngshow-preventing-animation-when-it-starts-first-time">this one</a>, but involves the new animations in AngularJS 1.2.0.</p> <p>Basically, I have a bunch of elements on my signup page that are initially hidden and only displayed when a particular form element is invalid (they point to the invalid form element and display a message like "password needs to be at least 8 characters"). These messages fade in and out as they are shown/hidden.</p> <p>But as soon as the signup page is displayed the elements are visible and fade out. They are briefly visible (they "blink" or "flash" on the screen, as is the case in situations where ng-cloak is necessary).</p> <p><a href="http://plnkr.co/edit/ovsyUzZiznMHnsG33ERZ" rel="nofollow noreferrer">Here's</a> a plunker to demonstrate the behaviour that I'm experiencing. In this plunker I have set up a basic route (the "login" page) that contains a box and a button that toggles the box's visibility. Notice how the box fades out when you click run? It should just be hidden. (I've deliberately set the animation to be slow so you can see the animation occurring).</p> <p><strong>How can I stop the animation from occurring initially?</strong></p> <p>What I've tried:</p> <ul> <li>Set <code>ng-cloak</code> on the animating elements.</li> <li>Use <code>ng-cloak</code> with the <code>display: none !important</code> rule added. (See <a href="https://stackoverflow.com/questions/13432311/ng-cloak-and-ng-show-flashes-the-hidden-element-on-screen">this</a>)</li> <li>Setting <code>display: none</code> on the element, as if it were an "initial setting" for the element. (See <a href="https://stackoverflow.com/questions/16158021/prevent-angularjs-animation-from-running-on-element-that-is-initially-hidden-whe">this</a>)</li> </ul> <p>Interestingly, <a href="http://plnkr.co/edit/apukoNfLZGJZ8V7VwDF0" rel="nofollow noreferrer">this</a> plunker behaves properly and the animation doesn't occur initially. <em>This plunker doesn't use routing and the controller is set explicitly on the body tag.</em> I want to use routing though.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload