加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

twitter-bootstrap – 将动态数据从AngularJS显示到Twitter Boot

发布时间:2020-12-18 00:22:00 所属栏目:安全 来源:网络整理
导读:我试图让Bootstrap Popover使用AngularUI passthrough在AngularJS中处理动态绑定数据.在我的小提琴中,我无法动态显示每个办公室的办公地点和人员名单: http://jsfiddle.net/stevenng/wmJtr/3/ 解决方法 你可以这样做的一种方法就是在像 this fiddle这样的ui
我试图让Bootstrap Popover使用AngularUI passthrough在AngularJS中处理动态绑定数据.在我的小提琴中,我无法动态显示每个办公室的办公地点和人员名单: http://jsfiddle.net/stevenng/wmJtr/3/

解决方法

你可以这样做的一种方法就是在像 this fiddle这样的ui-options中引用office:
<div ng-repeat="office in offices">
  <a href="" ui-jq="popover" ui-options="{title:office.location,content:office.people.join(',')}">Test Popover - {{office.location}}</a>    
</div>

另一种方法是通过将当前项目传入其中的函数生成ui-options,如this fiddle.

使用这个html代码段:

<div ng-repeat="office in offices">
  <a href="" ui-jq="popover" ui-options="popoverOptions(office)">Test Popover - {{office.location}}</a>    
</div>

而这个控制器代码:

$scope.offices = [
    {location:'Europe',people:['andy','gloopy']},{location:'USA',people:['shaun','teri']},{location:'Asia',people:['ryu','bison']}];

$scope.popoverOptions = function(office){
    return { title: office.location,content: office.people.join(',') };
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读