From bc8d21c151e67aec5dc2ab709be45dac18f79ae1 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 9 Jan 2014 21:35:54 +0100 Subject: [PATCH] feat(modal): expose dismissAll on $modalStack Closes #1334 Closes #1552 --- src/modal/modal.js | 8 ++++++++ src/modal/test/modal.spec.js | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modal/modal.js b/src/modal/modal.js index ce1ec83d34..8be63d596e 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -250,6 +250,14 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition']) } }; + $modalStack.dismissAll = function (reason) { + var topModal = this.getTop(); + while (topModal) { + this.dismiss(topModal.key, reason); + topModal = this.getTop(); + } + }; + $modalStack.getTop = function () { return openedWindows.top(); }; diff --git a/src/modal/test/modal.spec.js b/src/modal/test/modal.spec.js index 26b606d45f..53b52403d2 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -229,7 +229,6 @@ describe('$modal', function () { expect($document).toHaveModalOpenWithContent('Content', 'div'); expect($document).not.toHaveBackdrop(); }); - }); describe('option by option', function () {