Skip to content

Instantly share code, notes, and snippets.

@NishuGoel
Created January 4, 2019 19:37
Show Gist options
  • Save NishuGoel/3d0ab2c95ad900cd7a8f846e6d4b94db to your computer and use it in GitHub Desktop.
Save NishuGoel/3d0ab2c95ad900cd7a8f846e6d4b94db to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { AngularFirestore } from 'angularfire2/firestore';
@Component({
selector: 'app-root',
template: `
<ul>
<li *ngFor="let d of data | async">
<pre>{{ d | json }}</pre>
</li>
</ul>
`
})
export class AppComponent {
public data: Observable<any[]>;
constructor(db: AngularFirestore) {
this.data = db.collection('/data').valueChanges();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment