【发布时间】:2018-06-21 10:15:22
【问题描述】:
我正在使用 Angular 6,并按照Guide 中的步骤将材料组件添加到我的项目中。但是当我在我的代码中使用步进器组件时,我在控制台中得到以下异常:
NewReqComponent.html:16 ERROR TypeError: _this._driver.validateStyleProperty is not a function
at browser.js:844
at Array.forEach (<anonymous>)
at browser.js:843
at Array.forEach (<anonymous>)
at AnimationAstBuilderVisitor.push../node_modules/@angular/animations/fesm5/browser.js.AnimationAstBuilderVisitor._validateStyleAst (browser.js:840)
at AnimationAstBuilderVisitor.push../node_modules/@angular/animations/fesm5/browser.js.AnimationAstBuilderVisitor.visitStyle (browser.js:780)
at AnimationAstBuilderVisitor.push../node_modules/@angular/animations/fesm5/browser.js.AnimationAstBuilderVisitor.visitState (browser.js:678)
at browser.js:657
at Array.forEach (<anonymous>)
at browser.js:655
我是这样使用组件的:
<mat-horizontal-stepper>
<mat-step label="step1">step1</mat-step>
<mat-step label="step2">step2</mat-step>
</mat-horizontal-stepper>
和 app.module.ts:
imports: [
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot(appRoutes) ,
FormsModule, HttpClientModule ,
FormWizardModule ,
ArchwizardModule,
MatStepperModule
],
【问题讨论】:
-
在您的 package.json 中,尝试将 @angular/animations 更改为 6.0.5 版本,然后运行 npm install。
-
我试过了,它不起作用,我仍然得到同样的错误
-
stackblitz.com/edit/angular-g6ymwe 我希望这个演示对您有所帮助
-
我投票关闭这个作为stackoverflow.com/questions/50990209/…的副本
标签: angular angular-material angular-material2 angular6