Angularjs错误:[$ injector:modulerr] http://errors.angularjs.org/1.4.7/$injector/modulerr?p0

时间:2015-10-06 22:06:10

标签: javascript angularjs

我正在尝试通过网络摄像头阅读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>

1 个答案:

答案 0 :(得分:2)

您似乎没有将ngRouter库注入模块,如此,

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

请参阅herehere

另外,请确保在角度之后导入Angular路径库,如此,

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