我是一个node.js新手,在学习了一个简单的教程之后,我尝试加载一个使用node.js的开源应用程序,并得到了下面的错误。我确信这是一个微不足道的配置问题,但我没有看到。
ReferenceError: angular is not defined
at Object.<anonymous> (d:\projects\nodeapp\app\app.js:7:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3这是发生错误的app.js。
/**
* App bootstrap script <----- START OF FILE
*/
'use strict';
var nodeapp = angular.module('nodeapp', ['ngRoute', 'ngSanitize', 'ngAnimate']); <----- ERROR这是index.html
<!doctype html>
<html ng-controller="AppCtrl">
<head>
<meta charset="utf-8">
<title>App</title>
<link href="./visual/css/main.css" rel="stylesheet" type="text/css">
<script src="./bower_components/jquery/jquery.min.js"></script>
<script src="./bower_components/angular/angular.js"></script>
<script src="./bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="./bower_components/angular-route/angular-route.js"></script>
<script src="./bower_components/angular-animate/angular-animate.js"></script>
... more scripts ...
<script src="./app.js"></script>
</head>
<body class='app-not-ready'>
<ng-view></ng-view>
<div class="notification-bar"
ng-if="notificationBarVisible"
ng-animate
ng-bind="notificationMessage"></div>
</body>
</html>这是文件夹结构

发布于 2014-09-29 21:21:34
你只是糊涂了。=) AngularJS是前端JavaScript框架,只在客户端(浏览器)工作。NodeJS是一个编写服务器端的平台。以快速框架上的NodeJS应用程序为例。https://github.com/dizel3d/bicycles。首先,需要安装NodeJS及其模块(在命令行node i中的项目根目录中运行)。启动node app.js并打开http://localhost:3000。
https://stackoverflow.com/questions/26108870
复制相似问题