Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/434.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度4布线动画仅适用于入口_Javascript_Angular_Animation_Routes_Angular4 - Fatal编程技术网

Javascript 角度4布线动画仅适用于入口

Javascript 角度4布线动画仅适用于入口,javascript,angular,animation,routes,angular4,Javascript,Angular,Animation,Routes,Angular4,我有一个Angular应用程序,我在其中的几个组件之间进行路由。我最近开始为此添加动画,但动画仅显示一种方式: @Component({ selector: 'about', templateUrl: '../views/about.component.html', styleUrls: ['../scss/about.css'], animations: [ trigger("aboutAnimate", [ state('*', style

我有一个Angular应用程序,我在其中的几个组件之间进行路由。我最近开始为此添加动画,但动画仅显示一种方式:

@Component({
  selector: 'about',
  templateUrl: '../views/about.component.html',
  styleUrls: ['../scss/about.css'],
  animations: [
    trigger("aboutAnimate", [
      state('*',
        style({ left: '0' })
      ),
      state('void',
        style({ left: '-100%' })
      ),
      transition(
        "* => void", [
          animate(1000),
          style({ left: '-100%' })
        ]
      ),
      transition(
        "void => *", [
          animate(1000),
          style({ left: '0' })
        ]
      )
    ])
  ],
  host: {
    "[@aboutAnimate]": 'true',
    'style': 'display: block; position: absolute; top: 0;'
  }
})
下面是一个示例组件装饰器及其动画配置,此配置由多个路由共享(将@aboutAnimate更改为适合)。这将创建在路由到(在“void=>”条件下)时从左侧滑入的路由,但在路由远离(“=>void”条件)时不会设置动画

对于这些条件,我也使用了:enter/:leave速记,得到了相同的结果

当新组件滑入时,正在远离的组件确实会在1000毫秒内挂起,因此它似乎理解它正在被设置动画,因为它不仅会消失,而且在离开时不会应用任何样式


我漏了什么吗?

你能帮我修一下吗?我也有同样的问题,Github上的每个bug都涉及Angular的早期版本。你在使用4.0.1吗?我下班后会检查版本,但没有,我还没有找到solution@IgnacioRuiz我使用的是4.0.0,很抱歉这里也出现了类似的问题。请告诉我们您是否找到了解决方案?