在Webstorm中设置Angular.js?

时间:2015-08-30 06:22:03

标签: javascript angularjs node.js webstorm

我试图在webstorm中设置node.js和angular.js项目但我收到此错误信息:

/usr/bin/node app/src/app.js
/home/dac/WebstormProjects/web-plugin/app/src/app.js:1
ion (exports, require, module, __filename, __dirname) { var myApp = angular.mo
                                                                    ^
ReferenceError: angular is not defined
    at Object.<anonymous> (/home/dac/WebstormProjects/web-plugin/app/src/app.js:1:75)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Process finished with exit code 1

我将angular.min.jr作为文件添加到我的框架设置中,并安装并配置了node.js.我应该怎么做才能让它运行?这是app.js

var myApp = angular.module('AngularChromeEx', []); //"ExecuteScriptService", "SendMessageService"
/*
myApp .config(['$routeProvider',
    function($routeProvider) {
        $routeProvider.
            when('/browserPopup', {
                templateUrl: 'views/PopupView.html',
                controller: 'PopupController'
            }).
            otherwise({
                redirectTo: 'views/PopupView.html'
            });
    }]);
    */

1 个答案:

答案 0 :(得分:3)

在这种情况下,该问题应该与用于加载的lib的顺序相关。必须在调用之前加载Angular文件。检查此link