daniel
daniel

Reputation: 35733

Use bootstrap popover in ng-repeat

I have a bootstrap popover which works outside of an angular ng-repeat.

<a href="#" class="tt1" data-trigger="hover" data-html="true" data-selector="" data-original-title="first tooltip" data-content="fldsfkjsdöflsj dlfödjs">Hover over me</a>

As soon as I use it inside an ng-repeat it stops working. I initialize the popover in the angular controller constructor.

$('.tt1').popover();

Upvotes: 2

Views: 6167

Answers (1)

alexandrin88
alexandrin88

Reputation: 4400

You should create a popover directive.

angular.module('yourModule').directive('popover', function() {
   return function(scope, elem) {
      elem.popover();
   }
});

Then you use it on the element:

<a href="#" class="tt1" popover data-trigger="hover" data-html="true" data-selector="" data-original-title="first tooltip" data-content="fldsfkjsdöflsj dlfödjs">Hover over me</a>

Upvotes: 16

Related Questions