I use snack-bar to show notifications. I want to change background color when the response is: error (background: red) or success(background : green).
Code:
let config = new MdSnackBarConfig();
config.duration = 500;
snackBarRef = this.snackBar.open("Message", "", config);
snackBarRef.afterOpened().subscribe(()=>{ });
snackBarRef.afterDismissed().subscribe(()=>{ });
I tried to use:
let snackContainer = document.getElementById("cdk-overlay-0");
snackContainer.firstElementChild.setAttribute("style","background-color:red");
but the snack-bar disappear.
+1, I tried lots of css selectors and couldnt get any luck which sucked a bit.
This was added with https://github.com/angular/material2/pull/2804 which will be in the next release.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
This was added with https://github.com/angular/material2/pull/2804 which will be in the next release.