我有一个角度项目,其中包含以下设置:
var app = angular.module('viewerApp',
['ngFileSaver', 'tw.services.fileReader',
'ngRoute', 'ngAnimate',
'tw.directives.clickOutside', 'ngResource']);
app.config(function($routeProvider) {
$routeProvider
.when('/index', {
templateUrl: 'partials/some-page.html',
controller: 'Ctrl'
})
.otherwise({ redirectTo: '/index' });
});
app.controller('topicCtrl', function($scope, $routeParams, $http, $timeout) {
........
});
它适用于本地机器但是当我在github上部署它时(在gh-pages上)我收到以下错误:
错误:[$ injector:modulerr]由于以下原因导致无法实例化模块viewerApp: [$ injector:modulerr]无法实例化模块tw.directives.clickOutside,原因如下: [$ injector:nomod]模块'tw.directives.clickOutside'不可用!您要么错误拼写了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。 http://errors.angularjs.org/1.4.7/ $注射器/ NOMOD?P0 = tw.directives.clickOutside minErr /< @ https://github.wdf.sap.corp/pages/UA-Prototypes-Group/test/bower_components/angular/angular.js:68:12 模块/< @ https://github.wdf.sap.corp/pages/UA-Prototypes-Group/test/bower_components/angular/angular.js:1986:17 确保@ https://github.wdf.sap.corp/pages/UA-Prototypes-Group/test/bower_components/angular/angular.js:1910:38 .......
这是我的html,我在其中添加了对clickOutside的引用:
<html
ng-app="viewerApp"
ng-controller="headerCtrl"
dir="ltr">
<head>
<!-- jQuery -->
<script src="public/lib/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="public/lib/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-file-reader/angular-file-reader.js"></script>
<script src="node_modules/angular-click-outside/angular-click-outside.js"></script>
<script src="public/lib/angular-file-saver/dist/angular-file-saver.bundle.js"></script>
<!-- Controllers -->
<script src="js/viewer-app.js"></script>
<script src="js/viewer-ctrl.js"></script>
我检查了angular-click-outside.js文件,它位于node_modules目录中。
有人可以解释一下这个错误是什么,为什么我只能在git网站上而不是在localhost上得到它?