进入动画角不打 [英] Enter animation not playing in Angular

查看:105
本文介绍了进入动画角不打的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我怎么能当动画角应用程序正在启动一个元素。

I'm wondering how could I animate an element when the angular app is starting.

事实上,我看到(我也许做错了)的动画模块未触发输入事件的第一次,但之后一切顺利。我怎么能不重写所有code我有我的动画模块别处动画呢?

Indeed, I see (I'm maybe doing something wrong) that the animation module is not triggering the "enter" event the first time, but after everything goes fine. How could I animate it without rewriting all the code I have in my animation module somewhere else ?

您可以看到我的小提琴认为李是绿色的第一眼,我的时候需要它是蓝色在我进入动画定义。

You can see on my fiddle that the li is green at first glance, when I need it to be blue as defined in my enter animation.

我不知道这是否只发生在我的配置是如下:

I don't know if it only occurs in my configuration which is the following :

<li ng-if="$index === value" ng-repeat="proj in projects" class="test-anim">test</li>

,动画测试,动画类。

, animating the test-anim class.

谢谢您的回答

推荐答案

这是在1.2.3设计。看到这个问题:

This is by design in 1.2.3. See this issue:

https://github.com/angular/angular.js/issues/5130

您可以使用这样的超时时间,试图等到页面将数据添加到NG-重复之前渲染/ NG-IF:

You could use a timeout like this to try to wait until the page is rendered before adding data to your ng-repeats/ng-if:

$timeout(function(){
        $scope.value = 0;
        $scope.projects = [{}, {}, {}];      
    }, 0);

这篇关于进入动画角不打的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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