Angular2 Material SnackBar 集成问题
Angular2 Material SnackBar integration problems
我正在尝试将 Material Snackbar 集成到我的 angular2 应用程序中。
我已经成功地从同一个库中集成 ProgressBar
,但是 运行 与 SnackBar 发生错误。
这是我整合的方式SnackBar
(相关)app.module.ts:
imports: [
BrowserModule,
HttpModule,
FormsModule,
CoreModule,
UsersModule,
AppRoutingModule,
MaterialModule.forRoot(),
],
(相关)app.component.ts:
constructor(private route: ActivatedRoute,
private router: Router,
private snackBar: MdSnackBar,
private viewContainerRef: ViewContainerRef) {
}
// this method is bound to a simple button in template
showSnack() {
this.snackBar.open("Showing Snack", "Yayyy!");
}
单击 showSnack
按钮后,出现此错误:
ORIGINAL EXCEPTION: view.animationContext.getAnimationPlayers is not a function
更详细的堆栈跟踪:
我不知道为什么,但这是软件包版本的问题。
这个问题出现在 Material 2.0.0-alpha.11-3
而我的 angular 出现在 2.2.0
。
将 material 库更新为 2.0.0-beta.1
解决了我的问题。
我正在尝试将 Material Snackbar 集成到我的 angular2 应用程序中。
我已经成功地从同一个库中集成 ProgressBar
,但是 运行 与 SnackBar 发生错误。
这是我整合的方式SnackBar
(相关)app.module.ts:
imports: [
BrowserModule,
HttpModule,
FormsModule,
CoreModule,
UsersModule,
AppRoutingModule,
MaterialModule.forRoot(),
],
(相关)app.component.ts:
constructor(private route: ActivatedRoute,
private router: Router,
private snackBar: MdSnackBar,
private viewContainerRef: ViewContainerRef) {
}
// this method is bound to a simple button in template
showSnack() {
this.snackBar.open("Showing Snack", "Yayyy!");
}
单击 showSnack
按钮后,出现此错误:
ORIGINAL EXCEPTION: view.animationContext.getAnimationPlayers is not a function
更详细的堆栈跟踪:
我不知道为什么,但这是软件包版本的问题。
这个问题出现在 Material 2.0.0-alpha.11-3
而我的 angular 出现在 2.2.0
。
将 material 库更新为 2.0.0-beta.1
解决了我的问题。