html标签在uib-tooltip中不起作用

时间:2017-09-26 07:11:51

标签: angularjs html5

我正在使用tootltiptrusashtml,但文字显示为字符串,而不是解析为html。

HTML:

<label uib-tooltip="{{TooltipText}}"
       tooltip-enable="!showEditHours"
       for="IsAttested"
       ng-class="{'Cursor_Auto': !showEditHours}">Text</label>

控制器:

 $scope.ad = { 'text': 'This attestation is editable only when the  <b>   Hours of the Accounting Firm of the Issuer  </b>  section has been enabled for edit. Please click on the Edit <b> Hours of the Accounting Firm of the Issuer </b>  button.' };
 $scope.TooltipTextAttestationFinalName = $sce.trustAsHtml($scope.ad.text);

2 个答案:

答案 0 :(得分:0)

您有两种选择。

第一种是使用指令uib-tooltip-html,它根据documentation获取一个计算结果为html字符串的表达式。这可能是您正在寻找的:

<label uib-tooltip-html="TooltipText"
   tooltip-enable="!showEditHours"
   for="IsAttested"
   ng-class="{'Cursor_Auto': !showEditHours}">Text</label>

另一个是uib-tooltip-template,它采用一个解析为模板路径的表达式。

答案 1 :(得分:0)

试试这个

<label uib-tooltip-html="{{TooltipText}}"
       tooltip-enable="!showEditHours"
       for="IsAttested"
       ng-class="{'Cursor_Auto': !showEditHours}">Text</label

控制器

$scope.ad = { 'text': 'This attestation is editable only when the  <b>   Hours of the Accounting Firm of the Issuer  </b>  section has been enabled for edit. Please click on the Edit <b> Hours of the Accounting Firm of the Issuer </b>  button.' };
 $scope.TooltipTextAttestationFinalName = $sce.trustAsHtml($scope.ad.text);
相关问题