Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 80df015

Browse files
Robbert Merlierwesleycho
Robbert Merlier
authored andcommitted
feat(modal): allow appending outside iframe
- Loosen to accept jqLite element straight up Closes #4818
1 parent 5bf4052 commit 80df015

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/modal/docs/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The `$uibModal` service has only one method: `open(options)` where available opt
1919
* `windowTemplateUrl` - a path to a template overriding modal's window template
2020
* `size` - optional suffix of modal window class. The value used is appended to the `modal-` class, i.e. a value of `sm` gives `modal-sm`
2121
* `openedClass` - class added to the `body` element when the modal is opened. Defaults to `modal-open`
22-
* `appendTo` - Appends the modal to a specific element. appendTo must be an `angular.element`. Defaults to `body` element. Example: `appendTo: $document.find('aside')`.
22+
* `appendTo` - Appends the modal to a specific element. appendTo must be an `angular.element`. Defaults to `body` element. Example: `appendTo: $document.find('aside').eq(0)`.
2323

2424
Global defaults may be set for `$uibModal` via `$uibModalProvider.options`.
2525

src/modal/modal.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
281281

282282
function removeModalWindow(modalInstance, elementToReceiveFocus) {
283283
var modalWindow = openedWindows.get(modalInstance).value;
284-
var appendToElement = $document.find(modalWindow.appendTo).eq(0);
284+
var appendToElement = modalWindow.appendTo;
285285

286286
//clean up the stack
287287
openedWindows.remove(modalInstance);
@@ -424,7 +424,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
424424

425425
openedClasses.put(modalBodyClass, modalInstance);
426426

427-
var appendToElement = $document.find(modal.appendTo).eq(0),
427+
var appendToElement = modal.appendTo,
428428
currBackdropIndex = backdropIndex();
429429

430430
if (!appendToElement.length) {
@@ -565,8 +565,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
565565
backdrop: true, //can also be false or 'static'
566566
keyboard: true
567567
},
568-
$get: ['$injector', '$rootScope', '$q', '$templateRequest', '$controller', '$uibModalStack',
569-
function ($injector, $rootScope, $q, $templateRequest, $controller, $modalStack) {
568+
$get: ['$injector', '$rootScope', '$q', '$document', '$templateRequest', '$controller', '$uibModalStack',
569+
function ($injector, $rootScope, $q, $document, $templateRequest, $controller, $modalStack) {
570570
var $modal = {};
571571

572572
function getTemplatePromise(options) {
@@ -614,7 +614,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
614614
//merge and clean up options
615615
modalOptions = angular.extend({}, $modalProvider.options, modalOptions);
616616
modalOptions.resolve = modalOptions.resolve || {};
617-
modalOptions.appendTo = modalOptions.appendTo || 'body';
617+
modalOptions.appendTo = modalOptions.appendTo || $document.find('body').eq(0);
618618

619619
//verify options
620620
if (!modalOptions.template && !modalOptions.templateUrl) {

0 commit comments

Comments
 (0)