如何在工具提示中显示 html ng-repeat

How to show html ng-repeat inside tooltip

我正在使用 angularjs,所以我在我的应用程序中添加了一个指令。

app.directive('tooltip', function () {
    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            $(element)
                .attr('title', scope.$eval(attrs.tooltip))
                .tooltip({ placement: "right" });
        }
    }
})

我想显示下面的 html 或类似的东西,我只想显示 tooltip

中的客户列表
<ol>
    <li ng-repeat='dt in detail.SelectedCustomers'>{{dt.name}}</li>
</ol>

下面是我的 table tooltip 所在的位置。

<tr ng-repeat="detail in mainCtrl.lineDetails">
    <td><a href="#" data-toggle="tooltip" data-placement="right" data-html="true" tooltip="detail.SelectedCustomers"><i class="fa fa-eye fa-lg" aria-hidden="true"></i></a></td>
</tr>

我做了一个 fiddle 来告诉你怎么做

.directive("myTooltip", [ function(){
return{
scope: {
customers:'=myTooltip'
},
link:function(scope, el){
var toDisplay = '';
for(var i = 0; i < scope.customers.length; i++){
toDisplay += scope.customers[i].name+'\n';
}

el.attr('title', toDisplay);