1

当使用 Kendo Grid 将鼠标悬停在计数列上时,我试图在弹出窗口中显示项目名称列表。从 API 响应中获取项目名称。

我正在使用 popover-template 来引用外部模板。出于某种原因,当我使用 popover-template 时,我的外部模板没有被引用。当我使用静态数据时只需弹出它就可以了。但就我而言,我需要根据项目数量建立一个列表

     columns: [
            {  field: 'name',
                title: 'APP',
                template: function (a) {
                    var tmp = '<a ng-href="#/applications/'+a.id+'">'+a.name+'</a>';
                    return tmp;
                }
            },
            {  field: 'count',
                title: 'COUNT',
                template: function(dataItem) {
                    var htmlTemplate = $templateCache.get('appCount.html');
                    $scope.applications = dataItem.applications;
                    var htmlObj = $compile(htmlTemplate)($scope);

                    var tmp ='<span popover-template="'+htmlObj.html()+'" popover-placement="right" popover-trigger="mouseenter" data-html="true">'+dataItem.count+'</span>';
                    return tmp;

                }

            }
    ]

外部模板保存为 appCount.html 并具有以下内容

      <ul class="app-popover">
      <li ng-repeat="app in applications" ng-bind-html="app.name">
      </li>
     </ul>

我基本上是在尝试将动态数据绑定到 $scope 变量,以便在从中调用它的控制器中进行引用。

有没有其他方法可以构建此列表并显示工具提示。任何帮助表示赞赏。我正在为此苦苦挣扎,而且对角度也很陌生

4

0 回答 0