Deke
Deke

Reputation: 4659

How to iterate through an array within the object in angular

This is how the array is in the data:

$scope.persons = [{
 cc:["abqwQe12c", "iu63enWzy", "dj101OQaQ"]
},
 {
cc:["erie1wka", "irt2naszsd", "riger1OQ"]
}]

In html it displays as an array when called like this {{person.cc}}. But below doesn't give anything.

 <div ng-repeat = "person in persons"> 
   <div ng-repeat = "ccs in person"> 
    {{ccs.cc}} 
   </div>  
</div>  

Upvotes: 0

Views: 140

Answers (1)

charlietfl
charlietfl

Reputation: 171698

You want the inner repeat to loop over the person.cc property array

 <div ng-repeat = "person in persons"> 
    <div ng-repeat = "ccs in person.cc"> 
       {{ccs}} 
     </div> 
 </div> 

Upvotes: 3

Related Questions