Guest User

Untitled

a guest
Dec 10th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. //Na classe do componente ao qual que quero exibir os dados no template eu tenho essa variavel:
  2.  
  3. categorias: Observable<any>
  4.  
  5. // Nomeu metodo OnInit eu atualizo o valor dela
  6. ngOnInit() {
  7. this.categorias = this.banco.getAll()
  8. }
  9.  
  10.  
  11. //Com essa função aqui
  12. getAll() {
  13. return this.db.list(`salas/${this.idSala}`)
  14. .snapshotChanges()
  15. .pipe(
  16. map(changes => {
  17. return changes.map(c => ({ key: c.payload.key, ...c.payload.val() }));
  18. })
  19. );
  20. }
Add Comment
Please, Sign In to add comment