I am struggling in getting Material Design Lite (MDL) to work with the 2.0.0-rc.1 version of Angular2, specifically with dynamic content.
I have two components, one being the main app component that incorporates the second. I can put HTML into the main component's template, use MDL classes, have the component implement OnInit
and call componentHandler.upgradeDom()
from there. All HTML added thus far is now registered by MDL.
However when I have the second component use a service
and dynamically add the result into its template, then this stuff is not registered by the first componentHandler.upgradeDom()
. I don't understand why calling componentHandler.upgradeDom()
from the second component after it has added the dynamic content does not work, either. I thought it should. Does it use a different componentHandler
or something?
Another idea would be to have the 2nd component somehow call a function of the first component to tell it to use its componentHandler
and update the DOM from there, but I don't know how to do that.
For test purposes I added a native Javascript file that calls the very same and have a button trigger it - that works.
I have found several directives on StackOverflow that supposedly auto-register all new HTML, but none work for me. Does anyone know how to do this for this version of Angular2?