小编Oli*_*ner的帖子

将角度动画添加到主机元素

我通过动画添加了一个动画

@Component({
   ....,
   animations: [
      trigger('slideIn', [
          ...
      ])
   ],
   host: {
      '[@animation]': 'condition'
   }
}
Run Code Online (Sandbox Code Playgroud)

哪个运作良好,在编译时我被告知这已被弃用,我应该使用@HostBinding ......

@HostBinding('[@animation]') get slideIn() {
   return condition;
}
Run Code Online (Sandbox Code Playgroud)

这让我错了

Can't bind to '[@animation' since it isn't a known property of 'my-component-selector'.
Run Code Online (Sandbox Code Playgroud)

但我无法在我的模块中添加动画..我该怎么办?

animation angular angular-animations

21
推荐指数
2
解决办法
1万
查看次数

标签 统计

angular ×1

angular-animations ×1

animation ×1