【发布时间】:2018-02-12 16:34:02
【问题描述】:
我定义的组件:
@Component ({
selector: 'education',
templateUrl: './education.component.html',
styleUrls: ['./education.component.css'],
animations: [ fadeOutAnimation ],
host: {
'[style.display]': 'block',
'[style.position]': 'fixed',
}
})
export class EducationComponent {
@HostBinding('@routeAnimation') routeAnimation = true;
}
它的 .html:
<div class="row">
content in div
</div>
outside of div
动画:
export const fadeOutAnimation =
trigger('routeAnimation', [
state('*', style({
opacity: 1,
})),
transition(':enter', [
style({
opacity: 0
}), animate('1s', style({ opacity: 1}))
])
])
由于某种原因,动画只在不在 div 内的 html 上执行。 <div class="row"></div> 中的内容会立即出现,文本 outside of div 会按预期淡入。我不知道发生了什么,如何为 div 元素内的内容设置动画?
我在桌面上使用 chrome。
Version 64.0.3282.140 (Official Build) (64-bit)
【问题讨论】:
标签: angular angular2-routing angular2-animation