uib-tooltip-html它给我一个语法错误

时间:2016-01-19 18:11:28

标签: angularjs twitter-bootstrap

我有以下代码。

<button uib-tooltip-html='Review Requested <br>test' 
class="btn btn-default"><span class="zmdi zmdi-edit"></span>
    </button>

我收到以下错误

Error: [$parse:syntax] Syntax Error: Token 'Requested' is an unexpected token at column 8 of the expression [Review Requested <br> test] starting at [Requested <br> test].

2 个答案:

答案 0 :(得分:0)

GitHub上的这个关闭的issue使得它听起来像需要包含在元素中的值。例如:

<button uib-tooltip-html='<div>Review Requested <br>test</div>' 
class="btn btn-default">
  <span class="zmdi zmdi-edit"></span>
</button>

答案 1 :(得分:0)

试试这个: -

  var app = angular.module("test").config(function($sceProvider) {
            $sceProvider.enabled(false);
        });

 app.controller("testController", function($scope, $sce) {
     $scope.getToolTipHTML= function() {
            return $sce.trustAsHtml('<div>Review Requested <br>test</div>');
        }
    });
<button uib-tooltip-html='getToolTipHTML()' class="btn btn-default">
  <span class="zmdi zmdi-edit"></span>
</button>