使用安装最新的 Angular 到我的项目
npm install angular@1.5.0-beta.2
接下来,我将此匿名函数添加到我的 app.js 中:
(function () {
angular.module('TimeWaste', []);
}());
我还在我的 server.js 中使用它来引用我的 node_modules
。
app.use('/node_modules', express.static(__dirname + "/node_modules"));
然后我使用以下方法添加了对我的项目的引用:
<script scr="node_modules/angular/angular.js">
</script>
我在 app.js 文件上收到错误,它表明 Angular 未定义。
Uncaught ReferenceError: angular is not defined(anonymous function) @ app.js:2(anonymous function) @ app.js:3
有什么帮助吗?
最佳答案
只需替换您的引用
<script scr="node_modules/angular/angular.js">
用这个。
<script scr="angular/angular.js">
关于angularjs - Angular未定义,引用错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33907074/