gpt4 book ai didi

javascript - Uncaught Error : [$injector:modulerr] trying to inject $module

转载 作者:行者123 更新时间:2023-11-30 15:32:28 25 4
gpt4 key购买 nike

我正在尝试使用来自 Angular Bootstrap 的模态服务:

    <script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="js/index.js"></script>

我的应用 Controller (index.js):

var app = angular.module('emaApp', ['ui.bootstrap']);

app.controller('mainCtrl', ['$scope', '$http', '$modal', function($scope, $http, $modal) {
// ...
}]);

但是,我没有超出此错误消息的范围,也看不出问题所在:

jquery.min.js:2 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.1/$injector/modulerr?p0=emaApp&p1=Error%3A%…host%3A8080%2Fweb%2Fbower_components%2Fangular%2Fangular.min.js%3A21%3A332)
at angular.js:38
at angular.js:4759
at q (angular.js:357)
at g (angular.js:4720)
at eb (angular.js:4642)
at c (angular.js:1838)
at Mc (angular.js:1859)
at pe (angular.js:1744)
at HTMLDocument.<anonymous> (angular.js:32977)
at j (jquery.min.js:2)

最佳答案

要使用模式注入(inject) $uibModal

你的 Controller 将是:

app.controller('mainCtrl', ['$scope', '$http', '$uibModal', function($scope, $http, $uibModal) {
// ...
}

关于javascript - Uncaught Error : [$injector:modulerr] trying to inject $module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42023613/

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