使用 angular-cli 安装第 3 方 jquery-ui [英] 3rd party jquery-ui install with angular-cli

查看:28
本文介绍了使用 angular-cli 安装第 3 方 jquery-ui的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的 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 没有帮助.我将欣赏 jquery-ui 与 angular-cli 集成的工作示例

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';

这篇关于使用 angular-cli 安装第 3 方 jquery-ui的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆