diff --git a/modal.js b/modal.js index 6c295df..fe678ed 100644 --- a/modal.js +++ b/modal.js @@ -17,8 +17,8 @@ factory('btfModal', function ($animate, $compile, $rootScope, $controller, $q, $ var template = config.template, controller = config.controller || angular.noop, controllerAs = config.controllerAs, - container = angular.element(config.container || document.body), element = null, + container = angular.element(document.body), html, scope; @@ -48,6 +48,9 @@ factory('btfModal', function ($animate, $compile, $rootScope, $controller, $q, $ if (element.length === 0) { throw new Error('The template contains no elements; you need to wrap text nodes') } + if (config.container) { + container = angular.element(config.container); + } $animate.enter(element, container); scope = $rootScope.$new(); if (locals) {