要在各个地方添加评论

下面是angular.js表单中的线程注释的结构。

<form> <ul class="unstyled"> <!-- ng-class="{ '{{childcond}}': $index == selectedIndex }" --> <li ng-repeat="comment in comments" class="{{childcond}}" ng-init=" childcond=checkChild(comment.slug); reply.parentSlug=comment.slug; idstring=slashRemove(comment.slug);" > <strong>{{comment.author}}</strong><br> <p> {{comment.body}} </p> <a href="javascript:void(0)" class="replycomment" >reply</a> <div id="{{idstring}}" style="display:none;" > <input type="text" placeholder="Your Name" ng-model="reply.replyAuthor"><br> <span style="display:none;"> <input type="text" class="hidevalue" ng-model="reply.parentSlug" ng-value="{{comment.slug}}" > </span> <textarea name="" id="" cols="30" rows="10" placeholder="Comment" ng-model="reply.replyBody"></textarea> <input class="btn-primary" type="submit" value="reply" ng-click="replyComment(reply,$index)"> </div> </li> </ul> 

当我回复评论时,我在最后的地方得到了我的评论。 在这里输入图像描述

这是我在angular.js文件中的回复代码。

 $scope.replyComment = function(reply,$index) { socket.emit('comment', { author: reply.replyAuthor, body: reply.replyBody, parent_slug:reply.parentSlug }); clearForm(); }; socket.on('comment', function(comment) { $scope.$apply(function() { console.log(comment); $scope.comments.push(comment); }); }); 

console.log(注释)给出以下结构。

在这里输入图像描述 任何帮助将非常感激!!!