Alright?
Putting into practice what I learned in angular / ionic, I came across some doubts:
1- I made an ion-select with list of states coming from the firebase. When I typed the States model, I'm in doubt if in the model I do export interface
or export class
. I saw that I can do both ways, but what difference does it make and what does it mean?
2- When I returned the list of firebase states, I used this.af.database.ref ("/ states") and not this.af.database.list ("/ states") as it is in the course. I was doubtful at the time of return of the service. Because the syntax is different and it was not clear to me what kind and how this return is. See:
cadastro.ts
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 you can not explain well and want to see the whole code to better understand my doubts, follow in github: