diff --git a/src/dialog/dialog.js b/src/dialog/dialog.js index 67a192b2ce..92ef40730b 100644 --- a/src/dialog/dialog.js +++ b/src/dialog/dialog.js @@ -123,7 +123,7 @@ dialogModule.provider("$dialog", function(){ if (self.options.controller) { var ctrl = $controller(self.options.controller, locals); - self.modalEl.contents().data('ngControllerController', ctrl); + self.modalEl.children().data('ngControllerController', ctrl); } $compile(self.modalEl)($scope); diff --git a/src/dialog/test/dialog.spec.js b/src/dialog/test/dialog.spec.js index 8cbdcbf618..79d368462c 100644 --- a/src/dialog/test/dialog.spec.js +++ b/src/dialog/test/dialog.spec.js @@ -1,7 +1,7 @@ describe('Given ui.bootstrap.dialog', function(){ var $document, $compile, $scope, $rootScope, $dialog, q, provider; - var template = '
I\'m a template
'; + var template = '
I\'m a template
'; beforeEach(module('ui.bootstrap.dialog')); beforeEach(module('template/dialog/message.html')); @@ -287,4 +287,22 @@ describe('Given ui.bootstrap.dialog', function(){ expect($document.find('body > div.modal > div.modal-header').length).toBe(1); }); }); + + describe('when opening it with a template containing white-space', function(){ + + var controllerIsCreated; + function Controller($scope, dialog){ + controllerIsCreated = true; + } + + beforeEach(function(){ + createDialog({ + template:'
Has whitespace that IE8 does not like assigning data() to
', + controller: Controller + }); + openDialog(); + }); + + dialogShouldBeOpen(); + }); });