如何在cordova应用程序中创建两个离子模态?

Tes*_*ser 3 angularjs cordova ionic-framework ionic

嗨,在我的应用程序中,我已经有一个登录的离子模式

$ionicModal.fromTemplateUrl('templates/login.html', {
    scope: $scope
  }).then(function(modal) {
    $scope.modal = modal;
  });
Run Code Online (Sandbox Code Playgroud)

现在我需要用新的html页面创建一个新的离子模态.我怎样才能做到这一点?

Kar*_*mar 5

答案完全有效,但每次需要模态时​​都不需要创建新的控制器.

app.controller('Ctrl1' function($scope, $ionicModal){

     $ionicModal.fromTemplateUrl('modalA.html', {
          scope: $scope,
          animation: 'slide-in-up'
        }).then(function(modal) {
          $scope.ModalA= modal;
        });

     $ionicModal.fromTemplateUrl('modalB.html', {
          scope: $scope,
          animation: 'slide-in-up'
        }).then(function(modal) {
          $scope.ModalB= modal;
        });


    //now you can indivitaully call any modal to show

    $scope.ShowModalA = function (){
         $scope.ModalA.show()
    }

    $scope.ShowModalB= function (){
         $scope.ModalB.show()
    }

 })
Run Code Online (Sandbox Code Playgroud)