0

How to show comments in items?

This is where items save

$scope.items = [
{ 'item': 'one',
'comments':[{'comment':'comment'}]
},
{ 'item': 'two',},
{'item': 'three'}
];


<ul>
<li ng-repeat="ite in items">
{{ite.item}} {{ite.comments.length}}
<button ng    click="remove($index)">Remove</button> <div ng-repeat="c in ite.comments">{{c.comment}}</div>
</li>

</ul>

http://plnkr.co/edit/19w1Q3XhoWQcpxm5SuxX?p=preview

1 Answer 1

2

You Just missed to add your comment Div in between the list tag. please update the code like above code. I have checked on Plunker.

<li ng-repeat="ite in items">
{{ite.item}} {{ite.comments.length}}
<button ng-click="remove($index)">Remove</button> <div ng-repeat="c in ite.comments">{{c.comment}}</div></li>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.