【问题标题】:Angularjs Error: [$injector:modulerr] http://errors.angularjs.org/1.4.7/$injector/modulerr?p0Angularjs 错误:[$injector:modulerr] http://errors.angularjs.org/1.4.7/$injector/modulerr?p0
【发布时间】:2015-10-06 22:06:10
【问题描述】:

我正在尝试通过网络摄像头简单地读取 qr 代码,但我在控制台打开角度帮助页面中收到此错误但说使用 ngRoute

Error: [$injector:modulerr] http://errors.angularjs.org/1.4.7/$injector/modulerr?p0=q...)

这里有angular和html代码

<html ng-app="App">
<body ng-controller="qrCrtl">
<qr-scanner width="400" height="300" ng-success="onSuccess(data)" ng-error="onError(error)" />

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-resource.min.js"></script>
<script data-main="qr-scanner.js" src="require.js"></script>
<script src="src/jsqrcode-combined.min.js"></script>
<script>
var App = angular.module('App', ['qrScanner']);
   App.controller('qrCrtl', ['$scope', function($scope) {
    $scope.onSuccess = function(data) {
        console.log(data);
    };
    $scope.onError = function(error) {
        console.log(error);
    };
    $scope.onVideoError = function(error) {
        console.log(error);
    };
}]);
</script>
</body>
</html>

【问题讨论】:

  • 如果您添加完整的错误而不是截断的错误会有所帮助。
  • 您可能在检索qr-scanner.js 脚本时遇到问题。另外,Angular-qr-scanner 是有问题的图书馆吗?更多细节会有所帮助
  • 我通过 git repo 使用了这个例子
  • @kakashihatake:你能发布那个 repo 的链接吗?你能做朋克吗? sg.cc 建议的有关错误的更多详细信息?

标签: javascript angularjs


【解决方案1】:

看来你没有将ngRouter库注入到你的模块中,像这样,

var App = angular.module('App', ['qrScanner', 'ngRoute']);

herehere

另外,请确保在 Angular 之后导入 Angular 路由库,像这样,

<script src="js/angular.js"></script>
<script src="js/angular-route.js"></script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多