我正在尝试使用mdl-stepper,当我在index.html页面中添加步进器时工作正常。请找到下面的plunker链接
"https://plnkr.co/edit/m7EGqw?p=preview"
但是当我在一个单独的html中执行同样的操作并使用ui-router时,它无法正常工作。
"https://plnkr.co/edit/ixMI8FKbhyTgL5sYieVa?p=preview"
请告诉我这是什么问题?
答案 0 :(得分:1)
Stepper使用(componentHandler
)Material Design Lite的模式来注册新组件,并自动升级文档加载和可能在初始页面加载后添加的组件。
在您的情况下,Stepper是通过异步请求添加的(在初始页面加载之后)。为此,您必须手动升级Stepper组件才能正常工作。
异步中的代码。请求回电:
// The Stepper registers itself. Since you are adding dynamically, then you
// need to upgrade it. This line will upgrade all components that must.
componentHandler.upgradeAllRegistered();