刚开始使用角度 - 所以希望我不会错过一些绝对明显的东西。我正在使用 mean.js(Mongo、Express、Angular、Node 堆栈)并开发一个简单易用的应用程序来帮助我入门。我正在尝试将angular-hotkeys模块添加到我的应用程序中。
我使用安装了模块sudo npm install -g angular-hotkeys --save
然后我添加ApplicationConfiguration.registerModule('cfp.hotkeys');
到我的 core.client.module.js 文件中。
在我的 config.js 文件中,我添加了 cfp.hotkeys 作为依赖项:
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'taskmanager';
var applicationModuleVendorDependencies = ['ngResource', 'ngCookies', 'ngAnimate', 'ngTouch', 'ngSanitize', 'ui.router', 'ui.bootstrap', 'ui.utils', 'cfp.hotkeys'];
最后 - 我将热键绑定到我的控制器:
// Lists controller
angular.module('lists').controller('ListsController', ['$scope', '$stateParams', '$location', 'Authentication', 'Lists', 'SelectedList', 'hotkeys',
function($scope, $stateParams, $location, Authentication, Lists, SelectedList, hotkeys ) {
$scope.authentication = Authentication;
console.log('hotkeys');
但是每次我加载页面时都会出现以下错误:
Error: [$injector:unpr] Unknown provider: hotkeysProvider <- hotkeys http://errors.angularjs.org/1.2.22/$injector/unpr?p0=hotkeysProvider%20%3C-%20hotkeys
at http://localhost:3000/lib/angular/angular.js:78:12
at http://localhost:3000/lib/angular/angular.js:3792:19
at Object.getService [as get] (http://localhost:3000/lib/angular/angular.js:3920:39)
at http://localhost:3000/lib/angular/angular.js:3797:45
at getService (http://localhost:3000/lib/angular/angular.js:3920:39)
at invoke (http://localhost:3000/lib/angular/angular.js:3947:13)
at Object.instantiate (http://localhost:3000/lib/angular/angular.js:3967:23)
at http://localhost:3000/lib/angular/angular.js:7260:28
at http://localhost:3000/lib/angular/angular.js:6651:34
at forEach (http://localhost:3000/lib/angular/angular.js:332:20) <section data-ui-view="" class="ng-scope">
我知道我可能做错了一些非常简单的错误 - 但对于我的生活,我无法弄清楚它是什么。