Bootstrap   发布时间:2022-04-18  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Bootstrap popover在AngularJs ng-repeat中不起作用大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个国家列表,我正在使用Ng-repeat填充,一切都运行正常.此外,我试通过使用引导弹出窗口显示每个国家内的一些其他细节,它似乎没有工作,所以有人可以帮助我吗?

Html代码

<body ng-app="app" ng-controller="my_controller">    
<div class="span3 projectCard" ng-repeat="country in all_countries">
    <div class="projectCardHeight">
        <button class="btn close cardClose" ng-click="deleteCountry(country.id)">×</button>
        <div class="cardHeader">Country</div>
        <div class="cardBody">{{Country.iD}}</div>
        <div class="cardBody">{{Country.titlE}}</div>
        <div class="cardBody"><a href="#" id="pop{{Country.iD}}" class="btn btn-priMary" rel="popover" data-content="This is the <b>body</b> of Popover" data-original-title="Creativity Tuts">pop</a></div>
    </div>
</div>
 </body>

Javascript代码

var app = angular.module("app",[]);
app.controller('my_controller',function($scopE) {  
    $scope.all_countries = [
        {"id":28,"title":"Sweden"},{"id":56,"title":"USA"},{"id":89,"title":"England"}];
});

function deleteCountry(id)
{
    alert("Do something");
}

$(document).ready(function () {
    $("a[rel=popover]")
        .popover({ placement: 'bottom',html: 'true' })
        .click(function (E) {
            e.preventDefault();
        });
});

请参这个JsFiddle

解决方法

演示: http://jsfiddle.net/5ww8e/1/

创建一个名为bs-popover的新指令,并将其与ng-repeat一起应用.在bs-popover指令内触发popover方法.

你的js文件加载顺序也是错误的,你应该在bootstrap之前加载jquery.

大佬总结

以上是大佬教程为你收集整理的Bootstrap popover在AngularJs ng-repeat中不起作用全部内容,希望文章能够帮你解决Bootstrap popover在AngularJs ng-repeat中不起作用所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。