jQueryUI with angular4

时间:2017-08-04 11:18:17

标签: angular jquery-ui

我试图将自定义的jqueryUI datepicker组件添加到angular4项目中。目前我用普通的jquery,html和css开发了。我想将该组件添加到angular4。 我在下面尝试过,但是当运行npm start时会出错。

我的jquery ui datepicker(自定义为rangepicker)

enter image description here

这是我将jqueryUI导入angular4

的方法
 "apps": [
{
  "root": "src",
  "outDir": "dist",
  "assets": [
    "assets",
    "favicon.ico"
  ],
  "index": "index.html",
  "main": "main.ts",
  "polyfills": "polyfills.ts",
  "test": "test.ts",
  "tsconfig": "tsconfig.app.json",
  "testTsconfig": "tsconfig.spec.json",
  "prefix": "app",
  "styles": [
    "styles.css",
    "../node_modules/jquery-ui/../themes/base/all.css",
    "../node_modules/bootstrap/dist/css/bootstrap.min.css"
  ],
  "scripts": ["../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/jqueryui/jquery-ui.js",
    "../node_modules/bootstrap/dist/js/bootstrap.min.js"],
  "environmentSource": "environments/environment.ts",
  "environments": {
    "dev": "environments/environment.ts",
    "prod": "environments/environment.prod.ts"
  }
}

],

这是我在命令提示符中得到的错误

enter image description here

1 个答案:

答案 0 :(得分:5)

"scripts": ["node_modules/jquery/dist/jquery.min.js","node_modules/jqueryui/jquery-ui.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js"]
  

如果不通过提供完整路径工作,请尝试此操作。

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g angular-cli@1.0.0-beta.26

"styles": [
  "fullpath/styles.css",
  "node_modules/jquery-ui/../themes/base/all.css",
  "node_modules/bootstrap/dist/css/bootstrap.min.css"
],