问题
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();
回答1:
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>
来源:https://stackoverflow.com/questions/20334071/use-bootstrap-popover-in-ng-repeat