1

我有三个不同的控制器和视图模式弹出不打烊如果多个情态动词的存在

从屏幕按钮被点击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不会被打开不知道发生了什么实际的问题。

请帮帮我。提前致谢。

+0

你有多个模态的实例吗? –

回答

0

从主控制器首先打开你的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 
    } 

调用另一个函数并在该功能中打开另一个模式,并且类似地您可以执行此操作。