ngAnimate上ngShow。当它开始第一次preventing动画 [英] ngAnimate on ngShow. Preventing animation when it starts first time

查看:388
本文介绍了ngAnimate上ngShow。当它开始第一次preventing动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用最近添加angular.js动画功能玩耍,并根据需要不起作用

I was playing around with recently added angular.js animations feature, and this doesn't work as desired

<style>
    .myDiv{
        width:400px;
        height:200px;
        background-color:red;
    }
    .fadeIn-setup,.fadeOut-setup {
      -webkit-transition: 1s linear opacity;
      -moz-transition: 1s linear opacity;
      -o-transition: 1s linear opacity;
      transition: 1s linear opacity;
    }
    .fadeIn-setup{
      opacity:0;
    }
    .fadeOut-setup{
      opacity:1;
    }
    .fadeIn-setup.fadeIn-start {
      opacity: 1;
    }
    .fadeOut-setup.fadeOut-start{
        opacity:0;
    }
</style>

<div ng-app>
    <div ng-controller='ctrl'>
       <input type='button' value='click' ng-click='clicked()' />  
       <div ng-show="foo == true"  class='myDiv' ng-animate="{show: 'fadeIn', hide:'fadeOut'}">
       </div>
     </div>
</div>

function ctrl($scope){
    $scope.foo = false;
    $scope.clicked = function(){
       $scope.foo = !($scope.foo);
    }
}

http://jsfiddle.net/Kx4TS/1

它败坏走myDiv的 dom.ready 并启动它淡出。而它最初应该被隐藏。如何解决呢?

it spoils away myDiv on the dom.ready and starts it fading out. Whereas it initially should be hidden. How to fix that?

推荐答案

这现在已修正。升级到1.1.5。

This has been fixed now. Upgrade to 1.1.5.

这篇关于ngAnimate上ngShow。当它开始第一次preventing动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆