+
diff --git a/src/popover/docs/readme.md b/src/popover/docs/readme.md
index d69d415891..501585965c 100644
--- a/src/popover/docs/readme.md
+++ b/src/popover/docs/readme.md
@@ -17,6 +17,7 @@ will display:
`tooltip` directive for supported values.
- `popover-append-to-body`: Should the tooltip be appended to `$body` instead of
the parent element?
+- `popover-html-unsafe`: To add HTML-Content to the popover body.
The popover directives require the `$position` service.
diff --git a/src/popover/popover.js b/src/popover/popover.js
index c38ff9461e..a940234218 100644
--- a/src/popover/popover.js
+++ b/src/popover/popover.js
@@ -14,5 +14,17 @@ angular.module( 'ui.bootstrap.popover', [ 'ui.bootstrap.tooltip' ] )
})
.directive( 'popover', [ '$compile', '$timeout', '$parse', '$window', '$tooltip', function ( $compile, $timeout, $parse, $window, $tooltip ) {
return $tooltip( 'popover', 'popover', 'click' );
-}]);
+}])
+
+.directive( 'popoverHtmlUnsafePopup', function () {
+ return {
+ restrict: 'E',
+ replace: true,
+ scope: { title: '@', content: '@', placement: '@', animation: '&', isOpen: '&' },
+ templateUrl: 'template/popover/popover-html-unsafe-popup.html'
+ };
+})
+.directive( 'popoverHtmlUnsafe', [ '$tooltip', function ( $tooltip ) {
+ return $tooltip( 'popoverHtmlUnsafe', 'popover', 'click' );
+}]);
diff --git a/src/popover/test/popoverSpec.js b/src/popover/test/popoverSpec.js
index b7c5b34ad7..86eaf3fc95 100644
--- a/src/popover/test/popoverSpec.js
+++ b/src/popover/test/popoverSpec.js
@@ -46,4 +46,50 @@ describe('popover', function() {
}));
});
-
+describe( 'popoverHtmlUnsafe', function() {
+ var elm,
+ elmBody,
+ scope,
+ elmScope;
+
+ // load the popover code
+ beforeEach(module('ui.bootstrap.popover'));
+
+ // load the template
+ beforeEach(module('template/popover/popover-html-unsafe-popup.html'));
+
+ beforeEach(inject(function($rootScope, $compile) {
+ elmBody = angular.element(
+ '
Selector Text
'
+ );
+
+ scope = $rootScope;
+ $compile(elmBody)(scope);
+ scope.$digest();
+ elm = elmBody.find('span');
+ elmScope = elm.scope();
+ }));
+
+ it('should not be open initially', inject(function() {
+ expect( elmScope.tt_isOpen ).toBe( false );
+
+ // We can only test *that* the popover-popup element wasn't created as the
+ // implementation is templated and replaced.
+ expect( elmBody.children().length ).toBe( 1 );
+ }));
+
+ it('should open on click', inject(function() {
+ elm.trigger( 'click' );
+ expect( elmScope.tt_isOpen ).toBe( true );
+
+ // We can only test *that* the popover-popup element was created as the
+ // implementation is templated and replaced.
+ expect( elmBody.children().length ).toBe( 2 );
+ }));
+
+ it('should close on second click', inject(function() {
+ elm.trigger( 'click' );
+ elm.trigger( 'click' );
+ expect( elmScope.tt_isOpen ).toBe( false );
+ }));
+});
diff --git a/template/popover/popover-html-unsafe-popup.html b/template/popover/popover-html-unsafe-popup.html
new file mode 100644
index 0000000000..ef28470c46
--- /dev/null
+++ b/template/popover/popover-html-unsafe-popup.html
@@ -0,0 +1,8 @@
+