I would like to access the comments array and do some calculations to render the average of ratings (avgstars) and show the numbers of comments on a particular item in my firebase array.
Any idea?
ngOnInit() {
  this.route.params
    .pipe(switchMap((params: Params) => this.dishservice.getDish(params['id'])))
    .subscribe(dish => {
      this.dish = dish
      this.favorite = this.favoriteService.isFavorite(this.dish.id); 
      //compute the average of the comments and the render the length of the array
      this.numcomments = /* This is the locus --->*/ this.dish.comments.length;           
      let total =0; 
      this.dish.comments.forEach(comment =>total += comment.rating); 
      this.avgstars = (total/this.numcomments).toFixed(2); 
         },
        errmess => this.errMess = <any>errmess); 
      }

 
     
    