uib-tooltip-html 不工作
uib-tooltip-html not working
从 ui-bootstrap 的 0.14 版开始,它看起来像 uib-tooltip-html(以前是:tooltip-html-unsafe ) 不再工作了...或者不再像我以前那样工作了。
基本上,'tooltip' 在 '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>
http://plnkr.co/edit/fJt3nBbT6rSbiN50h7Bp?p=preview
并且由于 ui-bootstrap 文档缺少有关此指令的示例,我无法猜测我做错了什么。
有什么想法吗?
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>!');
我不得不这样做(感谢 Herbi Shtini 指出单引号 hack)
viewModel.tooltipContent = $sce.trustAsHtml('I\'ve been made <b>bold</b>!');
<div uib-tooltip-html="'{{main.tooltipContent}}'" tooltip-placement="bottom">
嘿,像这样尝试我得到 html 使用下面给出的 ubi-tooltip 的混合工具提示
在 JS 中。
app.controller("yoyoController", function($scope, $sce) {
$scope.text = $sce.trustAsHtml('Yo <b>Yo</b>');
});
在HTML
<div ng-controller="yoyoController">
<p uib-tooltip-html="text" >
A Thing With an HTML Tooltip
</p>
</div>
从 ui-bootstrap 的 0.14 版开始,它看起来像 uib-tooltip-html(以前是:tooltip-html-unsafe ) 不再工作了...或者不再像我以前那样工作了。
基本上,'tooltip' 在 '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>
http://plnkr.co/edit/fJt3nBbT6rSbiN50h7Bp?p=preview
并且由于 ui-bootstrap 文档缺少有关此指令的示例,我无法猜测我做错了什么。
有什么想法吗?
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>!');
我不得不这样做(感谢 Herbi Shtini 指出单引号 hack)
viewModel.tooltipContent = $sce.trustAsHtml('I\'ve been made <b>bold</b>!');
<div uib-tooltip-html="'{{main.tooltipContent}}'" tooltip-placement="bottom">
嘿,像这样尝试我得到 html 使用下面给出的 ubi-tooltip 的混合工具提示
在 JS 中。
app.controller("yoyoController", function($scope, $sce) {
$scope.text = $sce.trustAsHtml('Yo <b>Yo</b>');
});
在HTML
<div ng-controller="yoyoController">
<p uib-tooltip-html="text" >
A Thing With an HTML Tooltip
</p>
</div>