Reputation: 3
Javascript
<script>
var car=[
{
name:'honda',
color:'red',
comments:[
{
rating:3,
bidprice:"25,000"
},
{
rating:4,
bidprice="21,000"
]
}
];
</script>
What am i trying to do is getting the bid price of car from each comments by using ng-repeat. I did try like this
<li ng-repeat="car in carList">
{{car.comments.bidprice}}
</li>
Unfortunately, I getting nothing respond from this code. What should I do? Thanks you.
Upvotes: 0
Views: 45
Reputation: 11
comments is an array. or you do like this car.comments[0].bidprice or you do another ng-repat="comment in car.comments".
Upvotes: 0
Reputation: 10141
<li ng-repeat="comment in car.comments">
{{comment.bidprice}}
</li>
Should work. I am not sure where you took carList from.
Upvotes: 1