Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Angular.js加载脚本_Javascript_Angularjs_Mean Stack - Fatal编程技术网

Javascript Angular.js加载脚本

Javascript Angular.js加载脚本,javascript,angularjs,mean-stack,Javascript,Angularjs,Mean Stack,我有一个应用程序使用平均堆栈。当用户转到URL时: http://localhost:3000/edit/0 其中0是记录id。这似乎可以正常工作,但我的脚本未加载到我的edit.js文件中: <!doctype html> <html> <head> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"></script

我有一个应用程序使用平均堆栈。当用户转到URL时:

http://localhost:3000/edit/0

其中0是记录id。这似乎可以正常工作,但我的脚本未加载到我的edit.js文件中:

<!doctype html>
<html>
<head>
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"></script>
    <link rel="stylesheet" type="text/css" href="/css/style.css">

    <script src="bower_components/jquery/jquery.min.js"></script>
    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="bower_components/ng-file-upload/angular-file-upload-shim.min.js"></script> 

所以很明显,他们是在编辑目录中寻找脚本,而不是在我的根目录中。我怎样才能避开这件事?我需要在参数中传递id,因为它是GET。

哇。。。我只需要在每个路径之前添加../除非您在HTML标题部分中指定“base”标记或添加“/”以告知浏览器使用您的域+绝对路径,否则浏览器会将相对路径添加到URL以加载文件。 因此,要么在路径之前添加“/”,要么添加“../”,或者添加一个基标记。 祝你好运

GET http://localhost:5000/edit/bower_components/jquery/jquery.min.js 404 (Not Found)