Angular-ui Bootstrap 工具提示未显示在 ng-repeat(node-webkit 应用程序)中 [英] Angular-ui Bootstrap tooltips not showing in ng-repeat (node-webkit app)

查看:20
本文介绍了Angular-ui Bootstrap 工具提示未显示在 ng-repeat(node-webkit 应用程序)中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 angular.js 和 node-webkit 的新手,我正在努力使引导工具提示在通过 ng-repeat 动态加载的内容中工作.

I'm new to angular.js and node-webkit, and I'm struggling to make bootstrap tooltips work in content dynamically loaded via ng-repeat.

首先,我尝试使用标准引导程序并执行以下操作:http://jsfiddle.net/nsDFe/3/

First, I've tried using standard bootstrap and did the following : http://jsfiddle.net/nsDFe/3/

app.directive('bsTooltip', function () {
    return function (scope, element, attrs) {
        // trying to register the new tooltips
        element.find('span').tooltip();
    };
});

这不起作用(但第一个表格行中通常"定义的工具提示有效).

And this doesn't work (but the "normally" defined tooltip in the first table row works).

然后我尝试使用 angular-ui bootstrap 并执行以下操作(认为 angular 库会侦听新的 dom 元素应该是自动的"):http://jsfiddle.net/XTG8k/2/

Then I tried using angular-ui bootstrap and did the following (thinking it should be kind of "automatic" that the angular library would listen to new dom elements) : http://jsfiddle.net/XTG8k/2/

但也没有运气.有人能指出我正确的方向吗?我在 Stackoverflow 上看到了一些关于这个的讨论,但没有一个能真正解决我的问题.我听说过一些对 $compile 的模糊引用,但不知道如何实现.

But no luck either. Could someone point me in the right direction ? I've seen some discussions regarding this here on Stackoverflow but none that really solved my problem. I've heard some vague references to $compile but could not figure how to implement that.

推荐答案

我认为您只是以错误的方式处理此问题,您不应该在动态加载的内容中加载 html,而应该只加载你将放入你的html模板,然后你可以这样做:

I think you are just going about this the wrong way, you shouldn't be loading html in your dynamically loaded content, you should just be loading the data that you will put in your html template, and then you can do it like this:

http://jsfiddle.net/XTG8k/5/

<tr ng-repeat="foo in bar">
    <td><span tooltip="{{foo.tooltip}}">{{foo.content}}</span></td>
</tr>

这篇关于Angular-ui Bootstrap 工具提示未显示在 ng-repeat(node-webkit 应用程序)中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆