简体   繁体   English

在AngularJS中使用Material Design Lite

[英]Using Material Design Lite with AngularJS

I'm running into trouble trying to use Material Design Lite and AngularJS. 我在尝试使用Material Design Lite和AngularJS时遇到麻烦。 After googling for a bit, I found another stack overflow post regarding a similar issue: Material Design Lite Integration with AngularJS 进行了一段时间的搜索之后,我发现了另一个关于类似问题的堆栈溢出帖子: 与AngularJS集成的Material Design Lite

I am trying to load data into a table by pushing data from an ajax request into a model. 我正在尝试通过将数据从ajax请求推送到模型中来将数据加载到表中。 From there the view is updated by AngularJS. 从那里,视图由AngularJS更新。 Since the table uses Material Design Lite's javascript to add in functionality to select multiple entries, the new table entries do not seem to be updated with the proper classes/attributes. 由于表格使用了Material Design Lite的javascript来添加选择多个条目的功能,因此新表格条目似乎没有使用适当的类/属性进行更新。

As prescribed by others in the other stack overflow question, we need to run componentHandler.upgradeAllRegistered(); 正如其他堆栈溢出问题中其他人所规定的那样,我们需要运行componentHandler.upgradeAllRegistered(); . This does not seem to upgrade the elements correctly. 这似乎不能正确升级元素。

Here is a JSFiddle of an example: https://jsfiddle.net/chaseme/50n21fao/1/ 这是一个示例的JSFiddle: https ://jsfiddle.net/chaseme/50n21fao/1/

Does anyone have any insight on this? 有人对此有见识吗? Thanks. 谢谢。

I suggest you use the angular-material-design-lite project. 我建议您使用angular-material-design-lite项目。 It's a simple wrapper that will handle the integration for you. 这是一个简单的包装程序,可以为您处理集成。

Or you could use the Angular team's implementation . 或者,您可以使用Angular团队的实现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM