As I delve into the world of development, please forgive my lack of knowledge. My search for solutions brought me here. I am currently working on a comment and reply app. In order to add comments to my view, I am utilizing this specific function.
$scope.insertComment = function(){
var new_comment_id = $scope.comments[$scope.comments.length - 1].commentID +1;
var input = {
"commentID" : new_comment_id,
"userID": user.user_id,
"name": user.user_name,
"avatar_url": user.avatar,
"says": $scope.new_comment,
"likes": 0,
"like_status": false,
"replies": []
};
//Pushes changes to the global comment object
$scope.comments.push(input);
$scope.new_comment = '';
}
Every comment comes with an option to reply, triggered by the following event which displays a form for replying to the comment.
$(".no-url").click(function(){
console.log('test2');
$(this).parent().children('.reply-form').addClass('active');
});
My dilemma lies in the fact that newly added comments do not inherit this event listener. How can I resolve this issue?