Search code examples
angularjstwitter-bootstraptooltipangular-ui-bootstrapangularjs-ng-repeat

Angular-ui Bootstrap tooltips not showing in ng-repeat (node-webkit app)


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.

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).

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/

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.


Solution

  • 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>