angularjs - 将模块 "angular-hotkeys"添加到我的 mean.js 应用程序

标签 angularjs node.js hotkeys mean-stack meanjs

刚刚开始使用 angular - 所以希望我没有遗漏一些绝对明显的东西。我正在使用 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'];

最后 - 我将热键绑定(bind)到我的 Controller :

// 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">

我知道我可能做错了一些非常简单的错误 - 但对于我的生活我无法弄清楚它是什么。

最佳答案

这可能是因为该模块名为 cfp.hotkeys 而不是 hotkeys,这意味着您在文件中加载了错误的模块名称。

查看定义的模块名称here

更新:使用 bower 安装模块而不是使用 npm 并且也不是全局安装。

bower install angular-hotkeys --save

关于angularjs - 将模块 "angular-hotkeys"添加到我的 mean.js 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25706942/

相关文章:

windows - 我们可以为浏览器注册全局热键吗

visual-studio - 为什么 Git 扩展的 Visual Studio 自定义热键在重启后重置?

javascript - 在项目启动时从 $http.GET 设置 Angularjs 常量

node.js - 带有自己的 ObjectId 的 Mongoose 自引用抛出 : cast to ObjectId failed

javascript - Date.now 与 process.hrtime

node.js - 找不到用户 : Could not find user nodejs@sDatabase

java - 使用 Spring 和 Angular 的 Html5 路由

javascript - 让 ng-view 只显示它的内容,而不是它本身

javascript - 访问 Angular 中对象内部数组中的对象

macos - 未调用热键回调的事件 Tap(CFMachPortRef) 问题