Romain
Romain

Reputation: 3673

AngularJS : tooltip-html-unsafe inside a ng-bind-html

I'm stuck with an inception propblem :

<!-- html -->
<div class="well well-small" ng-bind-html="annotation"></div>

--

//Javascript
$scope.annotation = $scope.content;
for (it in words) {
    var tooltip = '<ul>' +
    '<li>' + words[it].info + '</li>' +
    '<li>' + words[it].name + '</li>' + 
    '<li>' + words[it].lol + '</li>' +
    '</ul>';

    $scope.annotation = $scope.annotation.replace(words[it].label, "<a tooltip-html-unsafe='" + tooltip + "'>" + words[it].label + "</a>");
}

So basically, annotation get a string, and I loop in 'words' to replace expressions presents in 'annotation' by the same but with a tooltip containing a list (ul) of informations.

Yet, even if the content appear, with words underlined in blue (like a link) I cannot find the tooltip.

Anyone knows where my problem would be ?

Thanks a lot !

Upvotes: 2

Views: 1615

Answers (1)

Romain
Romain

Reputation: 3673

Since nobody was able to anwser this (and it seems that there is no solution yet) I found another way to do a list inside a tooltip, without a tooltip-html-unsafe :

Basically you use the Unity Codes so instead of

'<li>' + words[i] + '</li>'

you get

'&#187;' + words[i] + '&#10;'

Where #187; stand for » and #10; for a new line.

Hope the two people who wanted an anwser (beside me) are satified, or else, maybe we can discuss further this issue.

Upvotes: 2

Related Questions