Angularjs 模态内部的角自举模态

Angularjs 模态内部的角自举模态,angularjs,angular-bootstrap,Angularjs,Angular Bootstrap,如何在模态中打开模态?我遵循了这一点,但当我点击第二个模式的确认按钮时出现了一个错误。这就是错误: 错误:[$injector:unpr] 这是我的第一个模态 $scope.edit = function(data) { var modalInstance = $uibModal.open({ templateUrl: "/wp-content/themes/copywriter-theme/angular-modal-template/managemen

如何在模态中打开模态?我遵循了这一点,但当我点击第二个模式的确认按钮时出现了一个错误。这就是错误:

错误:[$injector:unpr]

这是我的第一个模态

$scope.edit = function(data) {
        var modalInstance = $uibModal.open({
            templateUrl: "/wp-content/themes/copywriter-theme/angular-modal-template/management_modal.html",
            controller: 'managementModal',
            resolve: {
                items: function() {
                    return data;
                }
            }
        });
}
这是我的第二个模态

angular.module(['ui.bootstrap']).controller('managementModal',['$scope','$http','$uibModalInstance','$uibModal','items',function($scope, $http, $uibModalInstance, $uibModal, items){
    $scope.names = items;
    $scope.editable = items;

    $scope.cancel = function(){
        $uibModalInstance.dismiss('cancel');
        location.reload();
    };

    $scope.confirm = function(){
        console.log("clicked");
        $uibModalInstance.close($scope.editable);
    }

    $scope.update = function(){
        var template_modal = "<div class='modal-body'>" +
                                "<button type='button' class='close' ng-click='confirm()'>update</button>" +
                                "<button type='button' class='close' ng-click='cancel()'>cancel</button>" +
                            "</div>";
        var modalInstance = $uibModal.open({
            template: template_modal,
            controller: 'managementModal'
        });
    };
}]);
angular.module(['ui.bootstrap']).controller('managementModal'、['$scope'、'$http'、'$uibModalInstance'、'$uibModalInstance'、'items',函数($scope、$http、$uibModalInstance、$uibModalInstance,items){
$scope.names=项目;
$scope.editable=项目;
$scope.cancel=函数(){
$uibModalInstance.discover('cancel');
location.reload();
};
$scope.confirm=函数(){
控制台日志(“单击”);
$uibModalInstance.close($scope.editable);
}
$scope.update=函数(){
var template_modal=“”+
“更新”+
“取消”+
"";
var modalInstance=$uibModal.open({
模板:模板,
控制器:“管理模式”
});
};
}]);

因此,第一个模式位于另一个控制器中,而第二个模式位于控制器的内部
managementmodel
。但是,在plnkr中,点击按钮并正常工作我不知道为什么我的第二模式按钮不正常

我得到了答案,我需要再次声明
,所以在我的第二模式中,这应该是代码

$scope.update = function(){
        var template_modal = "<div class='modal-body'>" +
                                "<button type='button' class='close' ng-click='confirm()'>update</button>" +
                                "<button type='button' class='close' ng-click='cancel()'>cancel</button>" +
                            "</div>";
        var modalInstance = $uibModal.open({
            template: template_modal,
            controller: 'managementModal',
            //added code
            resolve: {
                items: function() {
                    return items;
                }
            }
        });
    };
$scope.update=function(){
var template_modal=“”+
“更新”+
“取消”+
"";
var modalInstance=$uibModal.open({
模板:模板,
控制器:“管理模式”,
//添加代码
决心:{
项目:功能(){
退货项目;
}
}
});
};

我得到了答案,我需要再次声明
,因此在我的第二个模式中,这应该是代码

$scope.update = function(){
        var template_modal = "<div class='modal-body'>" +
                                "<button type='button' class='close' ng-click='confirm()'>update</button>" +
                                "<button type='button' class='close' ng-click='cancel()'>cancel</button>" +
                            "</div>";
        var modalInstance = $uibModal.open({
            template: template_modal,
            controller: 'managementModal',
            //added code
            resolve: {
                items: function() {
                    return items;
                }
            }
        });
    };
$scope.update=function(){
var template_modal=“”+
“更新”+
“取消”+
"";
var modalInstance=$uibModal.open({
模板:模板,
控制器:“管理模式”,
//添加代码
决心:{
项目:功能(){
退货项目;
}
}
});
};

它是否适用于您的开发环境,或者您在进一步缩小它之后进行了测试,如果它适用于Plunker-我们无法帮助您。在你的工作中寻找问题project@MaximShoustin不,它在我的开发中不起作用。它在你的开发环境中起作用吗?或者你在进一步缩小它后进行了测试。如果它在Plunker中起作用,我们无法帮助你。在你的工作中寻找问题project@MaximShoustin不,这在我的发展中不起作用