I am trying to integrate Material Snackbar in my angular2 app.
I have already succesfully integrated ProgressBar
from the same library successfully but running into errors with SnackBar.
Here's how I am integrating SnackBar
(relevant) app.module.ts:
imports: [
BrowserModule,
HttpModule,
FormsModule,
CoreModule,
UsersModule,
AppRoutingModule,
MaterialModule.forRoot(),
],
(relevant) 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!");
}
Upon clicking that showSnack
button, I get this error:
ORIGINAL EXCEPTION: view.animationContext.getAnimationPlayers is not a function
I don't know why, but it was an issue with package versions.
This problem was on Material
2.0.0-alpha.11-3
while my angular is on2.2.0
.Updating material library to
2.0.0-beta.1
fixed my problem.