2015-10-06 37 views
2

我想通過網絡攝像頭簡單地閱讀qr代碼,但我在控制檯打開時出現此錯誤角的幫助頁面,但說用ngRoute

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

這裏的角和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

您可能在檢索'qr-scanner.js'腳本時遇到問題。此外,[Angular-qr-scanner](http://sembrestels.github.io/angular-qr-scanner/)有問題的庫?一些更多的細節將有所幫助 – scniro

+0

我使用git repo –

回答

2

看來你沒有注入ngRouter庫到您的模塊,像這樣,

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

herehere

此外,請確保您導入角路線庫后角,像這樣,

<script src="js/angular.js"></script> 
<script src="js/angular-route.js"></script> 
相關問題