0
all right?
Putting into practice what I learned in angular/Ionic, I came across some doubts:
1- I made an ion-select with a list of states coming from firebase. When I typed the model States, be in doubt if in the model I do export interface
or export class
. I saw that I can do it both ways, but what a difference and what a result it implies?
2- When I returned to the firebase status list, I used this.af.database.ref("/states") and not this.af.database.list("/states") as it is on the course. I was doubtful when returning from the service. Because the syntax is different and it was not clear to me what type and how this return is. See:
register.
ionViewDidLoad() {
this.estados = this.estadosService.listar();
}
cadastro.service.ts
listar():any{ // este any deveria ser do tipo Estados, correto?
return this.af.database.ref('/estados')
.once('value')
.then( (resposta) => {
return resposta.val();
})
.catch( (erro) => {
console.log(erro);
})
}
If I could not explain well and want to see the whole code to better understand my doubts, follow on github: