DOM Update when I added new Item


#1

Hi all,

I used angular fire 2 with chat Application in ionic2

I added value in firebase

But DOM Cannot display added value the same time

This is my code
constructor()
{
this.addcomment=this.af.database.list(’/complaints/’+this.key+’/COMMENTS’).map(i=>{return i});
this.getcomments();
}
getcomments()
{
//Get Comments

    this.af.database.list('/complaints/'+this.key+'/COMMENTS').map(i=>{return i}).first().subscribe(data=>{
      
      //filter User name for Conversations
          
         this.authservice.getalluser().first().subscribe(namelist=>
          {
             var userlist=[];
             namelist.forEach(userval=>
             {
               userlist.push(userval.val());
             })
              for(var i in data) 
            {
               var name=userlist.filter(neighboursname=>neighboursname.USER_ID.toString() === data[i].USER_ID.toString());
              
               this.Reply.push({
                 username:name[0].Username,
                 value:data[i]
               })
               console.log(this.Reply);
           }
         })
    })

}
Submit(comments)
{
this.addcomment.push(comments);
}

Kindly advice me,

Thanks & Regards