Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit c23cf26

Browse files
committed
interpolate tooltip-html
1 parent 2cdae21 commit c23cf26

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/js/angular-tooltips.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
return options;
3232
};
3333
})
34-
.directive('tooltips', ['$window', '$compile', '$interpolate', '$interval', 'tooltipsConfig',
35-
function manageDirective($window, $compile, $interpolate, $interval, tooltipsConfig) {
34+
.directive('tooltips', ['$window', '$compile', '$interpolate', '$interval', '$sce', 'tooltipsConfig',
35+
function manageDirective($window, $compile, $interpolate, $interval, $sce, tooltipsConfig) {
3636

3737
var TOOLTIP_SMALL_MARGIN = 8 //px
3838
, TOOLTIP_MEDIUM_MARGIN = 9 //px
@@ -98,11 +98,17 @@
9898
}
9999

100100
htmlTemplate = htmlTemplate + '<div class="' + CSS_PREFIX + 'title"> ' + INTERPOLATE_START_SYM + 'title' + INTERPOLATE_END_SYM + '</div>' +
101-
INTERPOLATE_START_SYM + 'content' + INTERPOLATE_END_SYM + html + ' <span class="' + CSS_PREFIX + 'caret"></span>' +
102-
'</div>';
101+
INTERPOLATE_START_SYM + 'content' + INTERPOLATE_END_SYM +
102+
' <span class="' + CSS_PREFIX + 'html_content" ng-bind-html="getHtml()"></span>' +
103+
' <span class="' + CSS_PREFIX + 'caret"></span>' + '</div>';
103104
$scope.title = title;
104105
$scope.content = content;
105106
$scope.html = html;
107+
108+
$scope.getHtml = function(){
109+
return $sce.trustAsHtml($scope.html);
110+
};
111+
106112
//parse the animation speed of tooltips
107113
$scope.parseSpeed = function parseSpeed() {
108114

0 commit comments

Comments
 (0)