0

from this

export class firebaseComponent {

public count: any;

ngOnInit() {
   var ref = this.db.database.ref('/approval');
   ref.limitToLast(1).on('child_added', function( snapShot ) {
      this.count = snapShot.myValue; // Doesn't work
   }
}

I can't use this.count because in Firebase function does't know what is this.count

How can I use it. I really want to get value from Firebase to show at {{count}} in HTML

aofdev
  • 1,772
  • 1
  • 15
  • 29

0 Answers0