angularjs ui.bootstrap $ modal不起作用

时间:2016-11-05 04:33:56

标签: angularjs ui.bootstrap

我是Angularjs的新人,我想问一下如何使用" ui-bootstrap"来完成我的$ modal工作。

我在我的控制台中出现了这种错误。

angular.min.js:118 Error: [$injector:unpr] http://errors.angularjs.org/1.5.8/$injector/unpr?p0=%24modalProvider%20%3C-%20%24modal%20%3C-%20myCtrl
at angular.min.js:6
at angular.min.js:43
at Object.d [as get] (angular.min.js:40)
at angular.min.js:43
at d (angular.min.js:40)
at e (angular.min.js:41)
at Object.invoke (angular.min.js:41)
at S.instance (angular.min.js:89)
at p (angular.min.js:65)
at g (angular.min.js:58)

    // my controller
   <script >
    angular.module('myApp', ['ui.bootstrap'])
    .controller('myCtrl', [ '$scope', '$modal',
        function($scope, $modal) {

    }]);

我的头标记:

 <link rel="stylesheet" type="text/css" href="/myAngularApp/css/style.css">
<script type="text/javascript" src="/myAngularApp/css/jquery/jquery.js"></script>
<script type="text/javascript" src="/myAngularApp/css/angular/angular.min.js"></script>
<script type="text/javascript" src="/myAngularApp/css/angular/angular-animate.min.js"></script>
<script type="text/javascript" src="/myAngularApp/css/angular/angular-route.min.js"></script>
<script type="text/javascript" src="/myAngularApp/css/bootstrap/bootstrap.js"></script>
<script type="text/javascript" src="/myAngularApp/css/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/myAngularApp/css/bootstrap/ui-bootstrap.min.js"></script>
<script type="text/javascript" src="/myAngularApp/css/bootstrap/ui-bootstrap-tpls.min.js"></script>

1 个答案:

答案 0 :(得分:0)

$modal更改为$uibModal

<script >
angular.module('myApp', ['ui.bootstrap'])
.controller('myCtrl', [ '$scope', '$uibModal',
    function($scope, $uibModal) {

}]);

Plunker

Docs