【发布时间】:2018-09-26 04:26:25
【问题描述】:
我正在开发一个 MEAN 应用,我的文件夹结构如下:
我在 /angular/src/assets/js 下添加了一个 js 文件用于一些 jQuery 的东西。
为此,我使用 npm 安装了 jQuery。
现在我需要通过angular.cli.json文件调用那个js文件。
angular.cli.json:
"apps": [
{
"root": "angular/src",
"outDir": "angular/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"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../src/assets/js/custom.js"
],
由于我将根指向“angular/src”,因此在位于“mean/node_modules/”下的脚本部分中包含 jquery.min.js 并以“未找到”错误结束时存在问题.
angular.cli.json 文件在“angular/src”根路径中查找“node_modules/jquery/dist/jquery.min.js”。
有什么方法可以在不改变我的文件夹结构的情况下解决这个问题?
需要别人的宝贵帮助。
【问题讨论】:
标签: javascript jquery angular