我正在使用express进行节点应用。我正在尝试将角度集成到它中,但我在Chrome控制台中遇到了这两个错误。
x GET http://localhost:3000/javascripts/apx.js localhost/:13
x Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.5/$injector/modulerr?p0=rough&p1=Error%3A%2…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.5%2Fangular.min.js%3A19%3A381) angularjs:38
这是我的app.js提供静态文件的方式:
var app = express();
app.set('views', path.join(__dirname, 'views'));
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
目录结构:
simpleapp > public > javascripts > apx.js
simpleapp > views > products > index.html
产品/ 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>
Javascript角/ apx.js:
var myapp = angular.module('rough', [])
myapp.controller('trx', function($scope){
$scope.title = "wuewe"
});