javascript – Angular中的模态不起作用.未处理的拒绝{}

我想创建一个模态(对话框).我已经按照官方bootstrap文档的例子,但我卡住了.当我尝试创建模态时,我收到一个错误

angular.min.js:122 Possibly unhandled rejection: {}

mainController:

 angular
.module('app')
.controller('tlmController',function($scope,$http,$timeout,$uibModal,DTOptionsBuilder,DataLoader,TestLines) {
    $scope.openTestLineDetails = function(id) {
        var modalInstance = $uibModal.open({
            size: 'lg',controller: 'testlineDetailsController',templateUrl: 'app/client/layout/testlinedetails.tpl.html',resolve: {
                testLineId: function() {
                    return id;
                }
            }
        });
    };
 })

和TestlineDetailsController:

angular
.module('app')
.controller('testlineDetailsController',$modalInstance,testLineId) {


});

这段代码有什么问题?我在主控制器中使用$uibModal($modal服务不存在).当我用$uibModalInstance替换$modalInstance时我也收到一个错误(service $uibModalInstance不存在),所以我必须在$modalInstance中使用$uibModal. Strage但是真的.

最佳答案
你可以在app.config中写下面的代码

app.config(['$qProvider',function ($qProvider) {
    $qProvider.errorOnUnhandledRejections(false);
}]);

相关文章

kindeditor4.x代码高亮功能默认使用的是prettify插件,prett...
这一篇我将介绍如何让kindeditor4.x整合SyntaxHighlighter代...
js如何实现弹出form提交表单?(图文+视频)
js怎么获取复选框选中的值
js如何实现倒计时跳转页面
如何用js控制图片放大缩小