2017-06-13 50 views
4

我正在关注的Getting Started说明添加材料零件的网页,和我得到第4步以下错误:如何将Material Components Web与Angular CLI项目集成?

<script>mdc.autoInit()</script> 
-> Uncaught ReferenceError: mdc is not defined at (index):17 

如前所述,这是一个角度CLI项目,所以脚本正在从.angular-cli.json文件加载:

"scripts": [ 
    "../node_modules/material-components-web/dist/material-components-web.js" 
] 

是否有CLI设置我应该加载该文件,或使呼叫mdc.autoInit()另一个地方?

我也看过Angular 2 Framework Integration的例子,它没有帮助。它不使用CLI,也不会调用mdc.autoInit()

回答

-1

在每个项目中都有一个index.html文件。你需要把你的脚本放在那里。

相关问题