DEK4
DEK4

Reputation: 73

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?

Upvotes: 1

Views: 5142

Answers (1)

Petr Averyanov
Petr Averyanov

Reputation: 9486

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');
  };
});

Upvotes: 4

Related Questions