-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Snackbar show method should not require message parameter #2628
Comments
@aadtyaraj01 Can you give an example of the rendered html? At a glance, it looks like you're missing the |
@williamernest I cannot figure out how to get that message from express connect-flash to mdc snackbar. I want to use it like the alert in bootstrap to display small notifications like
|
If you have to store the message in the html you can query the function initSnackbars() {
[].forEach.call(document.querySelectorAll('.mdc-snackbar'), barEle => {
var bar = new snackbar.MDCSnackbar(barEle);
const data = { timeout: 2750, message: barEle.querySelector('.mdc-snackbar__text').innerText };
bar.show(data);
});
} |
Thnx...worked like a charm! 😄 |
Re-opening this issue so we can fix the underlying problem, even though the user has a workaround. The |
### Issues fixed * Fixes #4005 (via new `mdc-snackbar-viewport-margin()` mixin) * Fixes #3981 * Fixes #2916 (via new `MDCSnackbar:closing` and `MDCSnackbar:closed` events) * Fixes #2628 * Fixes #1466 (via new `close()` method) * Fixes #1398 * Fixes #1258 * Fixes #11 (the label now expands indefinitely to fit the text) * Refs #2813 ### Screenshots ![Baseline without action button](https://user-images.githubusercontent.com/409245/49956261-a080ca80-feb9-11e8-8287-b7e805344115.png) ![Baseline with action button](https://user-images.githubusercontent.com/409245/49956109-4a138c00-feb9-11e8-9213-3241fa86a1b8.png) ![Stacked layout](https://user-images.githubusercontent.com/409245/49956173-6a434b00-feb9-11e8-8a03-2e58ccc8f763.png) BREAKING CHANGE: Snackbar's DOM and APIs have changed to match the latest design guidelines. See the Snackbar documentation for more information.
I am trying to use the snackbar that ships with MDC for web with connect-flash of express. If i simply add the snackbar element like this, it dosn't seem to work
Also, i've added the JS
The main problem seems to be the message attribute that has to be provided via data obj to
snackbar.show(data)
.Please, can you give me an example of how I can use mdc-snackbar with connect-flash.
The text was updated successfully, but these errors were encountered: