2017-07-16 41 views
1

我需要进口一些依赖于角CLI我的模块中进口依存度

import 'bootstrap/dist/css/bootstrap.css'; 
import 'jquery/dist/jquery.min.js'; 

它的工作,当我把在角cli.json脚本:[],但是当我把它放在我的app.module这依赖关系根本没有工作。

希望有人可以描述我的应用程序发生了什么。

+0

这是因为您必须安装'typings',它可以访问'* .d.ts'。 – Edric

+0

您是否尝试将其添加到polyfills.ts文件中? – Xepe

回答

0

它不工作的原因是因为您没有为关联的库安装Typescript declaration file (aka *.d.ts)。因此,请在控制台中输入以下命令:

npm install --save @types/jquery # Install jquery type declaration 
npm install --save @types/bootstrap # Install bootstrap type declaration 
+0

仍然得到“TypeError:$(...)。datepicker是不是一个函数”错误消息后,我安装这些。 但如果我把“../node_modules/jquery/dist/jquery.min.js”等在角度cli.json多数民众赞成工作正常,但我得到了凌乱的设计CSS – Wisnu