在我的应用程序中,我正在这样做:
angular.module('myApp.controllers', ['ngCookies']).
controller('AppCtrl', function ($scope, socket, $cookies) {
console.log("socket:");
console.log(socket);
$scope.component = 'main';
gLoggedIn = "no";
gUserName = "";
console.log("reset logged in status");
sid = $cookies;
$scope.setComponent = function(val) {
$scope.component = val;
}
}).
但我不断收到错误:
TypeError: 'undefined' is not an object (evaluating 'angular.module')" and "Error: No module: ngCookies
显然我在模块中加载了 ['ngCookies'] !更重要的是,我安装了 angular、angular-cookies 和 angular-loader,并将其添加到我的 index.jade 中:
script(src='bower_components/angular-cookies/angular-cookies.js')
script(src='bower_components/angular/angular.js')
script(src='bower_components/angular-loader/angular-loader.js')
那么给了什么?
我尝试在各个地方添加 ['ngCookies'] 无济于事:app.js,不;services.js,不;那么问题是什么?