我已经快速创建了一个简单的组件。
然而,它会触发一个错误,说我的
@Component({
selector: 'saved-overlay',
templateUrl: './saved-overlay.html',
exportAs: 'saved-overlay',
animations: [
trigger('inOut', [
transition('void => *', [
animate("300ms ease-out", keyframes([
style({opacity: 0}),
style({opacity: 1})
]))
]),
transition('* => void', [
animate("300ms ease-out", keyframes([
style({opacity: 1}),
style({opacity: 0})
]))
])
])
]
})
export class SavedOverlayComponent {
}
我在模板中这样调用它:
<saved-overlay #myOverlay='saved-overlay'></saved-overlay>
有没有办法从我的组件外部调用inOut动画(即在我引用此组件的模板中)。 理想情况下,我希望在组件本身上使用此动画:
<saved-overlay #myOverlay='saved-overlay' [@inOut]></saved-overlay>
然而,它会触发一个错误,说我的
inOut
动画未定义。