首页 > 解决方案 > TypeError:_this._driver.validateStyleProperty 不是函数 TypeError:_this._driver.validateStyleProperty 不是函数

问题描述

在这里我尝试向元素添加淡入淡出动画

home.component.html 的。但是发生了错误。这是在 Angular 6 上完成的。提前致谢。

在 home.component.ts 中添加动画 :[....] 部分后发生错误

//app.module.ts

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
   ]

//home.component.ts

@Component({
    selector: 'dhz-home',
    templateUrl: './home.component.html',
    styleUrls: ['home.scss'],
    animations: [
        trigger( 'fadeInOnLoad', [
            state('unloaded', style({
                transform: 'translateY(-200px)',
                visibility: 'hidden',
                transition: '.5s transform .2s visibility',
            })),
            state('loaded', style({
                visibility: 'visible',
                transform: 'translateY(0)'
            })),
            transition('unloaded => loaded',[
                animate('2s')
            ]),


        ])
    ]
})

//home.component.html

<p [@fadeInOnLoad]="isLoaded ? loaded : unloaded" >Fade Up</p>

错误链接图片

标签: angularangular6angular-animations

解决方案


推荐阅读