angular2能够为全局添加路由跳转动画吗?可以的话该怎么添加

我现在要为每个路由跳转都添加一个动画,按照官网的demo可以实现,不过得一个一个组件引入animations,没有一种全局设置动画的吗,使得不用在每个组件中又引入一次
我现在每个组件都得引入配置好的Animations,类似下面这样:


import { routeAnimation } from '../../animations';

@Component({
  selector: 'user-center',
  templateUrl: './user-center.component.html',
  styleUrls: ['./user-center.component.less'],
  animations: [routeAnimation]
})
阅读 3.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题