Reputation: 733
I have a Marionette based application, and now trying to include Material Design Lite via npm. Also, I have included the CSS for Material Design into my bundler and gulp
flow and this is working fine. However, when I switch routes for example, I have a button with ripple effect on mysite/#A and then I go to mysite/#B and then come back to mysite/#A, the CSS is all fine but the Material Design's JS fails to function (no ripple effect etc.). I am using ES6 with Babel and am importing material design in main.js
which starts the application. I also tried to re-import the same in the specific view, still no luck.
The effects work if I refresh the page in the browser.
How can I make this work on changing URLs within the SPA ?
Please let me know if any other information is required regarding the project or router implementation.
Upvotes: 1
Views: 46
Reputation: 733
Finally! So, the problem was that MDL requires componentHandler
's upgrade
to be called after dynamically elements are added to the DOM. With Marionette, I called that in view's onDomRefresh
and works like a charm.
Upvotes: 1