2012-08-14 13 views

Odpowiedz

5

Jednym ze sposobów można to zrobić jest po prostu przedstawieniu office w ui-options jak this fiddle:

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

Innym sposobem, w jaki można to zrobić, jest wygenerowanie ui-options za pośrednictwem funkcji przechodzącej do bieżącego elementu w taki sposób, jak this fiddle.

Dzięki temu kod HTML:

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

a kod kontrolera:

$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(',') }; 
}  
Powiązane problemy