From 7589339330caf1916dff178d03d3f5ee69c9178f Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Tue, 3 Sep 2013 20:01:36 +0200 Subject: [PATCH] fix(typeahead): remove dependency on ng-bind-html-unsafe Closes #813 --- src/bindHtml/bindHtml.js | 10 ++++++++++ src/tooltip/tooltip.js | 2 +- src/typeahead/typeahead.js | 2 +- template/typeahead/typeahead-match.html | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 src/bindHtml/bindHtml.js diff --git a/src/bindHtml/bindHtml.js b/src/bindHtml/bindHtml.js new file mode 100644 index 0000000000..cf635bc375 --- /dev/null +++ b/src/bindHtml/bindHtml.js @@ -0,0 +1,10 @@ +angular.module('ui.bootstrap.bindHtml', []) + + .directive('bindHtmlUnsafe', function () { + return function (scope, element, attr) { + element.addClass('ng-binding').data('$binding', attr.bindHtmlUnsafe); + scope.$watch(attr.bindHtmlUnsafe, function bindHtmlUnsafeWatchAction(value) { + element.html(value || ''); + }); + }; + }); \ No newline at end of file diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index 7fe8ed025c..b75124eb17 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -3,7 +3,7 @@ * function, placement as a function, inside, support for more triggers than * just mouse enter/leave, html tooltips, and selector delegation. */ -angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] ) +angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap.bindHtml' ] ) /** * The $tooltip service creates tooltip- and popover-like directives as well as diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index f09dadd18f..98b49fef07 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -1,4 +1,4 @@ -angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position']) +angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap.bindHtml']) /** * A helper service that can parse typeahead's syntax (string provided by users) diff --git a/template/typeahead/typeahead-match.html b/template/typeahead/typeahead-match.html index 5a660df0f1..d79e10a18f 100644 --- a/template/typeahead/typeahead-match.html +++ b/template/typeahead/typeahead-match.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file