Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果存在多个模态,则模态弹出窗口不关闭_Javascript_Angularjs_Twitter Bootstrap_Angular Ui Bootstrap - Fatal编程技术网

Javascript 如果存在多个模态,则模态弹出窗口不关闭

Javascript 如果存在多个模态,则模态弹出窗口不关闭,javascript,angularjs,twitter-bootstrap,angular-ui-bootstrap,Javascript,Angularjs,Twitter Bootstrap,Angular Ui Bootstrap,我有三个不同的控制器和视图 单击按钮时从屏幕打开Modal1 $modal.open({ templateUrl: 'abc.html', controller: 'abcCtrl', size: 'lg', scope: $scope, }); 在modal1中有“下一步”按钮,因此单击“下一步”按钮可关闭modal1并打开Modal2 $scope.validate = function(isValid) { if (!isValid) {

我有三个不同的控制器和视图

单击按钮时从屏幕打开Modal1

$modal.open({
    templateUrl: 'abc.html',
    controller: 'abcCtrl',
    size: 'lg',
    scope: $scope,
});
在modal1中有“下一步”按钮,因此单击“下一步”按钮可关闭modal1并打开Modal2

$scope.validate = function(isValid) {
    if (!isValid) {
        $scope.errors = 'Please fill-up required fields';
    } else {
        $scope.errors = '';
        $modal.open({
            templateUrl: 'Payment.html',
            controller: 'PaymentCtrl',
            size: 'lg',
            scope: $scope,
        });
    }
};
在modal2中有“下一步”按钮,因此单击“下一步”按钮可关闭modal2并打开Modal3

$scope.placeOrder = function() {
        $scope.cart.abc().then(function(result) {
                $modal.open({
                    templateUrl: 'orderSummary.html',
                    controller: 'SummaryCtrl',
                    size: 'lg',
                    scope: $scope,
                    resolve: {
                        items: function() {
                            return result.data;
                        }
                    }
                });
            },
            function(err) {
                //error msg
            });
};
如果我将$modalInstance.close添加到Modal1 打开另一个模式Modal2时,Modal1关闭,Modal2打开,但所有按钮均不工作。Modal3未打开,不知道实际问题发生了什么


请帮帮我。提前感谢。

您似乎正在寻找向导


从主控制器上看一看,在Modal1关闭时,首先打开Modal1,即

 var modalInstance = $modal.open({
                templateUrl: 'abc',
                controller: 'abcCtrl',
                size: 'lg',
                scope: $scope,
             });

            modalInstance.result.then(function(result) {
                  $scope.def();
              }, function(err) {
                //
            });

  $scope.def = function(){
     //open another 
    }

调用另一个函数,然后在该函数中打开另一个模态,同样,您也可以这样做。

一个模态是否有多个实例?