@guithomas wrote:
I would like to execute subscribe only once. Here is my code
let usuario_senha = this.usuario + "_" + this.senha; let subscription = this.afoDatabase.list('usuarios/', {query: { orderByChild: 'usuario_senha', equalTo: usuario_senha }}).take(1).subscribe((x) => { if(x.length == 1) { console.log("true"); } else { console.log("false"); }}, error =>{ console.error("Error in subscribe: ", error.message); }, () =>{ console.log("done"); });
it prints “false”/“true” and “done” 2x each time it is called.
Posts: 2
Participants: 1