简体   繁体   中英

AngularJS and bootstrap multiple modals

I'm using AngularJS and BootstrapUI for my modals and I need the possibility to open multiple modals at the same time, when I open a modal I need to put a button/link to open a secondone

Is there any way to do this?

May be I am missing smth, but there is not magic in modals: open modal = show some div with controller... The rest is done by css. http://plnkr.co/edit/GnadPfU9OFDFfyEa11vE?p=preview

modal in modal:

angular.module('ui.bootstrap.demo').controller('ModalInstanceCtrl', function ($scope, $modal, $modalInstance, items) {

  $scope.items = items;
  $scope.selected = {
    item: $scope.items[0]
  };

  $scope.open = function () {
    var modalInstance = $modal.open({
      templateUrl: 'myModalContent.html',
      controller: 'ModalInstanceCtrl',
      resolve: {
        items: function () {
          return $scope.items;
        }
      }
    });
  };

  $scope.ok = function () {
    $modalInstance.close($scope.selected.item);
  };

  $scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM