【发布时间】:2016-01-14 03:27:56
【问题描述】:
这是我的项目结构:
公开 -js --angular.min.js --angularApp.js 模板 - 意见 --index.ejs
这是我的 index.ejs 文件:
<html>
<head>
<title>My Angular app!</title>
<script type='text/javascript' src="../../public/js/angular.min.js"></script>
</head>
<body ng-app="flapperNews" ng-controller="MainCtrl">
<div>
{{test}}
</div>
<script type='text/javascript' src="../../public/js/angularApp.js"></script>
</body>
</html>
当我运行它时,我在 js 文件上收到 404 not found 错误。
我尝试将其添加到路由文件夹中的 middleware.js:
app.use("/public/js/angularApp.js", express.static(__dirname + '/public/js/angularApp.js'));
但这没有用,我也尝试使用此路径:
/public/js/
但也没有用。
如何在 ejs 文件中正确引用 Javascript 文件?
【问题讨论】:
标签: angularjs keystonejs