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

Commit

Permalink
feat(modal): allow appending outside iframe
Browse files Browse the repository at this point in the history
- Loosen to accept jqLite element straight up

Closes #4818
  • Loading branch information
Robbert Merlier authored and wesleycho committed Nov 4, 2015
1 parent 5bf4052 commit 80df015
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/modal/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The `$uibModal` service has only one method: `open(options)` where available opt
* `windowTemplateUrl` - a path to a template overriding modal's window template
* `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`
* `openedClass` - class added to the `body` element when the modal is opened. Defaults to `modal-open`
* `appendTo` - Appends the modal to a specific element. appendTo must be an `angular.element`. Defaults to `body` element. Example: `appendTo: $document.find('aside')`.
* `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)`.

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

Expand Down
10 changes: 5 additions & 5 deletions src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])

function removeModalWindow(modalInstance, elementToReceiveFocus) {
var modalWindow = openedWindows.get(modalInstance).value;
var appendToElement = $document.find(modalWindow.appendTo).eq(0);
var appendToElement = modalWindow.appendTo;

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

openedClasses.put(modalBodyClass, modalInstance);

var appendToElement = $document.find(modal.appendTo).eq(0),
var appendToElement = modal.appendTo,
currBackdropIndex = backdropIndex();

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

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

//verify options
if (!modalOptions.template && !modalOptions.templateUrl) {
Expand Down

0 comments on commit 80df015

Please sign in to comment.