Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Na classe do componente ao qual que quero exibir os dados no template eu tenho essa variavel:
- categorias: Observable<any>
- // Nomeu metodo OnInit eu atualizo o valor dela
- ngOnInit() {
- this.categorias = this.banco.getAll()
- }
- //Com essa função aqui
- getAll() {
- return this.db.list(`salas/${this.idSala}`)
- .snapshotChanges()
- .pipe(
- map(changes => {
- return changes.map(c => ({ key: c.payload.key, ...c.payload.val() }));
- })
- );
- }
Add Comment
Please, Sign In to add comment