How to use the @angular/fire/database.snapshotChanges function in @angular/fire

To help you get started, we’ve selected a few @angular/fire examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angularfire / src / database / list / snapshot-changes.spec.ts View on Github external
it('should handle empty sets', done => {
    const aref = createRef(rando());
    aref.set({});
    snapshotChanges(aref).pipe(take(1)).subscribe(data => {
      expect(data.length).toEqual(0);
    }).add(done);
  });
github angular / angularfire / src / database / list / snapshot-changes.spec.ts View on Github external
namefilter$.pipe(switchMap(name => {
      const filteredRef = name ? aref.child('name').equalTo(name) : aref
      return snapshotChanges(filteredRef);
    }),take(2)).subscribe(data => {
      count = count + 1;
github angular / angularfire / src / database / list / snapshot-changes.spec.ts View on Github external
function prepareSnapshotChanges(opts: { events?: ChildEvent[], skipnumber: number } = { skipnumber: 0 }) {
    const { events, skipnumber } = opts;
    const aref = createRef(rando());
    const snapChanges = snapshotChanges(aref, events);
    return {
      snapChanges: snapChanges.pipe(skip(skipnumber)),
      ref: aref
    };
  }