0

In my AngularFire2 database, for one of JSON entry want to know the length or size - how many parent nodes are available?

How to get the size of items? If it is zero (the items entry is not there), I will push a item:

items: FirebaseListObservable<any>;

this.items.push(item);


this.items = af.database.list('/items', { preserveSnapshot: true });
this.items
  .subscribe(snapshots => {
    snapshots.forEach(snapshot => {
      console.log(snapshot.key)
      console.log(snapshot.val())
    });
  })
AL.
  • 36,815
  • 10
  • 142
  • 281
Manu
  • 1,243
  • 5
  • 17
  • 43
  • Parent nodes are the child of some parent, so there are a lot of questions about how to get a child (parent) count. – Jay Apr 08 '17 at 14:16
  • Possible duplicate of [In Firebase, is there a way to get the number of children of a node without loading all the node data?](http://stackoverflow.com/questions/15148803/in-firebase-is-there-a-way-to-get-the-number-of-children-of-a-node-without-load) – Jay Apr 08 '17 at 14:16

0 Answers0