Created
November 21, 2018 22:38
-
-
Save lesimoes/3c2185479050c851e0ba692480a09773 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { AngularFireDatabase, AngularFireList } from 'angularfire2/database'; | |
import { Observable } from 'rxjs'; | |
@Component({ | |
selector: 'app-listagem', | |
templateUrl: './listagem.page.html', | |
styleUrls: ['./listagem.page.scss'], | |
}) | |
export class ListagemPage implements OnInit { | |
public listagem: Array<{ imagem: string; titulo: string; detalhes: string; key:string; }> = []; | |
listAcademia: AngularFireList<any>; | |
items: Observable<any[]>; | |
constructor(public database: AngularFireDatabase | |
) { | |
this.items = database.list('/academia').valueChanges(); | |
this.items.subscribe(data => { | |
data.forEach(value => { | |
let academia = { | |
imagem: '/assets/img/academia1.jpg', | |
titulo: value.unidade, | |
detalhes: value.detalhes, | |
key: 'String chave', | |
} | |
this.listagem.push(academia); | |
}) | |
}) | |
// for (let i = 1; i < 11; i++) { | |
// this.listagem.push({ | |
// imagem: '/assets/img/academia1.jpg', | |
// titulo: 'Academia ' + i, | |
// detalhes: 'detalhes da academia ' + i, | |
// key: 'String chave', | |
// }); | |
// } | |
} | |
ngOnInit() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment