从 ui-bootstrap 的 0.14 版开始,它看起来像 uib-tooltip-html(以前是:tooltip-html-unsafe)不再工作了......或者不是我以前让它工作的方式。
基本上,当 'tooltip-html' 不起作用时,'tooltip' 起作用:
<a href="#" uib-tooltip-html="UIB-TOOLTIP-HTML">UIB-TOOLTIP-HTML</a>
<a href="#" tooltip-placement="right" uib-tooltip="UIB-TOOLTIP">UIB-TOOLTIP</a>
http://plnkr.co/edit/fJt3nBbT6rSbiN50h7Bp?p=preview
而且由于 ui-bootstrap doc 缺少有关此指令的示例,因此我无法猜测我做错了什么。
任何想法?
最佳答案
example of the documentation of version 0.14绝对显示如何使用它。摘录:
HTML:
I can even contain HTML. <a href="#" uib-tooltip-html="htmlTooltip">Check me out!</a>
JS:
$scope.htmlTooltip = $sce.trustAsHtml('I\'ve been made <b>bold</b>!');
The latest doc还有一个例子:
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>
JS:
$scope.dynamicTooltipText = 'dynamic';
$scope.htmlTooltip = $sce.trustAsHtml('I\'ve been made <b>bold</b>!');
关于angularjs - uib-tooltip-html 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40992011/