gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 14:45:53 28 4
gpt4 key购买 nike

我正在尝试通过网络摄像头简单地读取二维码,但我在控制台打开 Angular 帮助页面时遇到此错误,但说使用 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>

最佳答案

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

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

参见 herehere

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

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

关于javascript - Angularjs 错误 : [$injector:modulerr] http://errors. angularjs.org/1.4.7/$injector/modulerr?p0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32980602/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com