我在将这些模块导入我的 angular2 组件时遇到问题。我使用来自 AngularClass 的 angular2-webpack-starter。
我使用 npm 安装依赖项:
npm install jquery --save
npm install malihu-custom-scrollbar-plugin --save
并安装打字:
typings install jquery --save --ambient
typings install mcustomscrollbar --save --ambient
我想在这样的组件中使用它:
jQuery('.selector').mCustomScrollbar();
最好的解决方案是什么?
我尝试使用这个解决方案:Whats the best way to use jquery widgets inside angular 2?
但这不起作用,我收到错误“未定义 jQuery”。