将custom.js脚本添加到Angular 5(MEAN)index.html文件

时间:2018-01-07 21:52:04

标签: javascript angular mean-stack

我有一个静态网站,我正在尝试使用Angular 5将其转换为MEAN堆栈。

我想为画廊,滚动等添加一些脚本和样式到我的HTML。这些脚本需要jQuery,我不需要访问它们,只需要运行它们。我将它们添加到.angular-cli.json中,如下所示:

"styles": [
    "styles.css",
    "./src/app/assets/css/font-awesome-4.3.0/css/font-awesome.min.css",
    "./src/app/assets/css/normalize.css",
    "./src/app/assets/css/owl.carousel.css",
    "./src/app/assets/css/owl.theme.css",
    "./src/app/assets/css/main.css",
    "./src/app/assets/css/responsive"
  ],
  "scripts": [
    "./src/app/assets/plugins/jquery-1.11.1.min.js",
    "./src/app/assets/plugins/jquery.smooth-scroll.min.js",
    "./src/app/assets/plugins/imagesloaded.js",
    "./src/app/assets/plugins/owl.carousel.min.js",
    "https://maps.googleapis.com/maps/api/js",
    "./src/app/assets/plugins/jquery.waypoints.min.js",
    "./src/app/assets/plugins/main.js"
  ],

还在 tsconfig.app.json 中添加了 allowJs:true

但是当我尝试运行 ng serve ng build 时出现错误。

  

无法将undefined或null转换为object   TypeError:无法将undefined或null转换为object       在hasOwnProperty()       at Object.hasProperty(/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:2229:31)       at parseConfig(/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:71815:16)       at /home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:71721:22       at Object.parseJsonConfigFileContent(/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:71735:11)       at Object.readTsconfig(/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/utilities/read-tsconfig.js:8:32)       在新的NgCliWebpackConfig(/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/models/webpack-config.js:19:42)       在Class.run(/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/tasks/serve.js:71:29)       at check_port_1.checkPort.then.port(/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/commands/serve.js:123:26)       在       at process._tickCallback(internal / process / next_tick.js:160:7)

我的linter也会在$(document).ready();上抛出错误,但我该如何替换呢?

0 个答案:

没有答案