Material Design Lite not fully working with Angular2

▼魔方 西西 提交于 2019-12-13 02:06:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!