2012-08-14 53 views

回答

5

的一种方式,你可以做到这一点是只是在ui-optionsthis fiddle引用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(',') }; 
}  
相关问题