3

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>
4
  • 1
    It would help if you added the full error rather than the truncated one. Commented Oct 6, 2015 at 22:07
  • 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 Commented Oct 6, 2015 at 22:11
  • I used this example by git repo Commented Oct 6, 2015 at 22:13
  • @kakashihatake: can you post the link of that repo? can you make a punk? more details about the error as sg.cc suggested ? Commented Oct 6, 2015 at 23:23

1 Answer 1

2

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.