uib-tooltip-html不能正常工作

Mar*_*vin 1 twitter-bootstrap angularjs angular-ui-bootstrap

从ui-bootstrap的0.14版开始,它看起来像uib-tooltip-html(previsously:tooltip-html-unsafe)不再起作用了......或者不是我过去使用它的方式.

基本上,当'tooltip-html'没有时,'工具提示'有效:

<a href="#" uib-tooltip-html="UIB-TOOLTIP-HTML">UIB-TOOLTIP-HTML</a>
<a href="#" tooltip-placement="right" uib-tooltip="UIB-TOOLTIP">UIB-TOOLTIP</a>
Run Code Online (Sandbox Code Playgroud)

http://plnkr.co/edit/fJt3nBbT6rSbiN50h7Bp?p=preview

由于ui-bootstrap doc没有关于这个指令的例子,我无法猜出我做错了什么.

任何的想法?

JB *_*zet 12

0.14版本的文档的例子无疑展示了如何使用它.摘录:

HTML:

I can even contain HTML. <a href="#" uib-tooltip-html="htmlTooltip">Check me out!</a>
Run Code Online (Sandbox Code Playgroud)

JS:

$scope.htmlTooltip = $sce.trustAsHtml('I\'ve been made <b>bold</b>!');
Run Code Online (Sandbox Code Playgroud)

最新的文档也有一个例子:

HTML:

<p>
    I can even contain HTML as a
    <a href="#" uib-tooltip-html="htmlTooltip">scope variable</a> or
    <a href="#" uib-tooltip-html="'static. {{dynamicTooltipText}}. <b>bold.</b>'">inline string</a>
</p>
Run Code Online (Sandbox Code Playgroud)

JS:

$scope.dynamicTooltipText = 'dynamic';
$scope.htmlTooltip = $sce.trustAsHtml('I\'ve been made <b>bold</b>!');
Run Code Online (Sandbox Code Playgroud)

  • 在加倍之后添加单引号为我完成了这项工作.谢谢 (6认同)