From dd415a980068efcd47b174029bbf207eb78665f3 Mon Sep 17 00:00:00 2001 From: Brian McKinney Date: Wed, 11 Dec 2013 15:35:49 -0700 Subject: [PATCH] fix(modal): Grab reference to body when it is needed in lieu of when the factory is created --- src/modal/modal.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modal/modal.js b/src/modal/modal.js index 12837f3fa9..b3036a3d43 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -106,7 +106,6 @@ angular.module('ui.bootstrap.modal', []) var backdropjqLiteEl, backdropDomEl; var backdropScope = $rootScope.$new(true); - var body = $document.find('body').eq(0); var openedWindows = $$stackedMap.createNew(); var $modalStack = {}; @@ -166,7 +165,9 @@ angular.module('ui.bootstrap.modal', []) backdrop: modal.backdrop, keyboard: modal.keyboard }); - + + var body = $document.find('body').eq(0); + if (backdropIndex() >= 0 && !backdropDomEl) { backdropjqLiteEl = angular.element('
'); backdropDomEl = $compile(backdropjqLiteEl)(backdropScope);