3

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'];

最後に、ホットキーをコントローラーにバインドしました。

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

私はおそらく非常に単純な間違ったことをしていることを知っていますが、私の人生では、それが何であるかを理解することはできません.

4

1 に答える 1

1

これは、モジュールがcfp.hotkeysnotと呼ばれていることが原因である可能性があります。つまりhotkeys、ファイルに間違ったモジュール名をロードしていることを意味します。

ここで定義されたモジュールの名前を参照してください

更新:グローバルではなく、使用するbower代わりに使用してモジュールをインストールします。npm

bower install angular-hotkeys --save

于 2014-09-07T05:58:43.830 に答える