3
votes

I am trying simply read qr code by web camera but I get this error in console open angular help page but saying using ngRoute

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

angular and html code here

<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
It would help if you added the full error rather than the truncated one. - sg.cc
You are probably having an issue retrieving the qr-scanner.js script. Also, is Angular-qr-scanner the library in question? Some more detail would be helpful - scniro
I used this example by git repo - kakashi hatake
@kakashihatake: can you post the link of that repo? can you make a punk? more details about the error as sg.cc suggested ? - Marwen Trabelsi

1 Answers

2
votes

It seems that you did not inject the ngRouter library into your module, like so,

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

See here and here

Also, make sure that you import the Angular route library after angular, like so,

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