我有一個將這些模塊導入到我的angular2組件的問題。我使用AngularClass的angular2-webpack-starter。如何將jquery和mCustomScrollbar插件導入到Angular2組件
我安裝依賴條件與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是沒有定義」。
嘿謝謝,這樣一個結構良好的答案。我已經學到了很多這種形式! –
感謝您的好朋友! –