ng-repeat 上的 AngularJS 工具提示

Asi*_*sim 1 javascript tooltip angularjs

我需要一些帮助来显示 AngularJS 的“工具提示”。问题是我ng-repeat在表格中,在某些行上显示了一个按钮,该按钮应该在悬停时显示工具提示。

工具提示正在显示,但问题是当我将鼠标悬停在一行时,所有行都显示了工具提示。它可能更好地在图像上说明: 在此处输入图片说明

这是我在控制器中的代码:

$scope.demo = {
            showTooltip: false,
            tipDirection: 'right'
        };
Run Code Online (Sandbox Code Playgroud)

如果需要,这是我的表:

<md-card  ng-repeat="container in containers | toArray:false |  filter:searchText.container.name">

    <md-toolbar>
        <div class="md-toolbar-tools">
            <h3>
                <span>{{container.account_name}}</span>
            </h3>
        </div>
    </md-toolbar>

    <md-card-title>
        <table class="table">
            <thead>
            <tr>
                <th>AccountName</th>
                <th>AccountID</th>
                <th>ContainerID</th>
                <th>ContainerName</th>
                <th>Options</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td><a href="{{container.tagManagerUrl}}">{{container.account_name }}</a></td>
                <td>{{ container.accountId }}</td>
                <td>{{ container.containerId }}</td>
                <td ng-if="!container.missing_live"><a href="/gui/tags/{{container.path}}">{{container.name}}</a></td>
                <td ng-if="container.missing_live">{{container.name}}


                    <md-tooltip md-visible="demo.showTooltip">Missing Live Container</md-tooltip>
                    <ng-md-icon icon="warning" size="20" style="fill: #ffd600"></ng-md-icon>


                </td>




                <td> <md-button class="md-icon-button" aria-label="More">
                    <ng-md-icon icon="more_vert"></ng-md-icon>
                </md-button></td>
            </tr>
            </tbody>
        </table>
    </md-card-title>
</md-card>
Run Code Online (Sandbox Code Playgroud)

这是表中的工具提示行:

 <md-tooltip md-visible="demo.showTooltip">Missing Live Container</md-tooltip>
                    <ng-md-icon icon="warning" size="20" style="fill: #ffd600"></ng-md-icon>
Run Code Online (Sandbox Code Playgroud)

所以我的目标是只显示用户悬停的工具提示。不是全部在表中。谢谢

zab*_*usa 5

添加showTooltip到容器对象。

<md-toolbar>
    <div class="md-toolbar-tools">
        <h3>
            <span>{{container.account_name}}</span>
        </h3>
    </div>
</md-toolbar>

<md-card-title>
    <table class="table">
        <thead>
        <tr>
            <th>AccountName</th>
            <th>AccountID</th>
            <th>ContainerID</th>
            <th>ContainerName</th>
            <th>Options</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td><a href="{{container.tagManagerUrl}}">{{container.account_name }}</a></td>
            <td>{{ container.accountId }}</td>
            <td>{{ container.containerId }}</td>
            <td ng-if="!container.missing_live"><a href="/gui/tags/{{container.path}}">{{container.name}}</a></td>
            <td ng-if="container.missing_live">{{container.name}}


                <md-tooltip md-visible="container.showTooltip">Missing Live Container</md-tooltip>
                <ng-md-icon icon="warning" size="20" style="fill: #ffd600"></ng-md-icon>


            </td>




            <td> <md-button class="md-icon-button" aria-label="More">
                <ng-md-icon icon="more_vert"></ng-md-icon>
            </md-button></td>
        </tr>
        </tbody>
    </table>
</md-card-title>
Run Code Online (Sandbox Code Playgroud)