Angularjs正在使用express在节点应用程序上抛出未捕获错误:[$injector:modulerr]
我正在用express做一个节点应用程序。我现在正试图将angular集成到它中,但我的chrome控制台中出现了这两个错误Angularjs正在使用express在节点应用程序上抛出未捕获错误:[$injector:modulerr],angularjs,node.js,express,Angularjs,Node.js,Express,我正在用express做一个节点应用程序。我现在正试图将angular集成到它中,但我的chrome控制台中出现了这两个错误 xgethttp://localhost:3000/javascripts/apx.js localhost/:13 x未捕获错误:[$injector:moduler]http://errors.angularjs.org/1.4.5/$injector/modulerr?p0=粗略&p1=错误%3A%2…ogleapis.com%2Fajax%2Flibs%2an
xgethttp://localhost:3000/javascripts/apx.js localhost/:13
x未捕获错误:[$injector:moduler]http://errors.angularjs.org/1.4.5/$injector/modulerr?p0=粗略&p1=错误%3A%2…ogleapis.com%2Fajax%2Flibs%2angularjs%2F1.4.5%2Fangular.min.js%3A19%3A381)angularjs:38
以下是my app.js提供静态文件的方式:
var app = express();
app.set('views', path.join(__dirname, 'views'));
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
目录结构:
simpleap>public>javascripts>apx.js
simpleapp>views>products>index.html
products/index.html:
<!DOCTYPE html>
<html ng-app="rough">
<head>
<title></title>
</head>
<body ng-controller="trx">
{{title}}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<script src="/javascripts/apx.js"></script>
</body>
</html>
您能为您的问题创建plunker吗?你的javascript加载了吗?我没有plunker。我现在正在读有关它的书。我的js文件未加载。此问题已修复。我必须重新启动我的服务器。我之前做了更改,但没有重新启动服务器。您能为您的问题创建plunker吗?你的javascript加载了吗?我没有plunker。我现在正在读有关它的书。我的js文件未加载。此问题已修复。我必须重新启动我的服务器。我之前做了更改,并没有重新启动服务器。
var myapp = angular.module('rough', [])
myapp.controller('trx', function($scope){
$scope.title = "wuewe"
});