我正在使用MEAN堆栈创建我的网站。在服务器上NodeJ正在运行,它有一个路由/测试并连接到DB。在Angularjs的cleint方面,我的client.ejs模板包含一个类似的脚本 这是在页面体中的控制器中使用的。现在,如果我点击某个点击路径/测试的页面并且Nodejs渲染加载client.ejs。我可以看到一个错误" 500内部错误"获取请求http://localhost:3000/test.js 为什么?它发生在这样吗?
nodejs代码:
app.post("/test",function(req,res))
{
/do some stuff with req
res.status(200);
res.render("public/hello");
}
hello.ejs:
<html>
<head>
<script scr="test.js"></script>
</head>
<body ng-app="my-app">
<div ng-controller="my-controller">
<form ng-submit="dosction()">
<input type=text>
<input type=submit>
</form>
</div>
</head>
<html>
test.js
angular.module("my-app",[]).controller("my-controller", function($scope){
dosaction=function()
{
//some stuff
}});