2012-08-14 26 views

Trả lời

5

Một cách để bạn có thể làm điều này là bởi chỉ tham khảo office trong ui-options như this fiddle sự:

<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>  

Một cách khác bạn có thể làm điều này là tạo ra các ui-options thông qua một chức năng đi qua trong mục hiện tại vào nó như this fiddle.

Với đoạn này html:

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

Và mã điều khiển này:

$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(',') }; 
}  
Các vấn đề liên quan