我有一个对象,它有评论和回复对象,回复对象还有嵌套的回复对象。我如何在 ng-repeat 上渲染它。我试过这个solution ,它使我的回复对象未定义。 例如这个
<div ng-repeat="it in item.CommentReplies=it.CommentReplies track by $index" >
最佳答案
你应该像这样使用两个 ng-repeat :
<div class="replylist" ng-repeat="it in item.CommentReplies track by $index">
{{it.Text}}
<div ng-repeat="comment in it.CommentReplies">
{{comment.Text}}
</div>
</div>
希望这对您有所帮助。 本来可以发表评论,但没有足够的声誉。
关于javascript - ng-repeat 嵌套嵌套对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45440802/