第三方jquery-ui用angular-cli安装 [英] 3rd party jquery-ui install with angular-cli
问题描述
我正在为我的angular2项目使用angular-cli.在我的项目中,我想使用jquery-ui.我用
I am using angular-cli for my angular2 project. In my project I want to use jquery-ui. I installed jquery-ui with
npm install jquery jquery-ui
我编辑了angular-cli-build.js
I edited my angular-cli-build.js
module.exports = function(defaults) {
return new Angular2App(defaults, {
vendorNpmFiles: [
'jquery/src/jquery.js',
'jquery-ui/jquery-ui.js'
]
});
};
它将如何在dist/vendor文件夹中自动更新,是否需要在index.html中添加css文件(例如css/jquery-ui.css)?
How it will update automatically in my dist/vendor folder , Do I need to add the css files (like css/jquery-ui.css) in my index.html like ?
我从 link ,但它对jquery-ui没有帮助. 我将欣赏一个与angular-cli集成jquery-ui的工作示例
I have followed the moment.js integration from this link but it didnt help with jquery-ui. I will appreciate a working example of jquery-ui integration with angular-cli
推荐答案
当您在angular-cli.json文件的脚本部分中添加.js文件时,它应该如上述方法所述工作.
It should work as mentioned in the above approach when you add .js files in the scripts section in the angular-cli.json file.
然后将其添加到您的主模块类中,并检查其是否正常工作.
With that please add this to your main module class and check whether it is working.
import 'jquery';
import 'jquery-ui';
这篇关于第三方jquery-ui用angular-cli安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!