问题
I have a simple HTML template built with MDL.
When I place the template into Angular2 App. Elements' actions and clicks are not working
E.g : Showing dropdowns
or clicking tabs
etc are not working.
I cant see any errors in Developer Console
and would like clarification on why this error is happening.
回答1:
Call componentHandler.upgradeDom();
in ngAfterViewInit()
and each time later when the DOM was modified:
ngAfterViewInit() {
componentHandler.upgradeDom();
}
See also Material Design Lite tooltips not working with Angular 2
来源:https://stackoverflow.com/questions/35981419/material-design-lite-not-fully-working-with-angular2