I have in Firebase a document with a list of users and another with this structure:
In the component "father" I obtain all the users:
<template is="dom-repeat" items="{{usuarios}}" as="usuario">
<admin-consulta-pagos-item usuario="{{usuario}}" yearmes="{{yearmes}}" id="consultaspagos"></admin-consulta-pagos-item>
</template>
then I call the "child" component and what I need to do is to search in a specific year_month if the user appears there, I have a property which I call: pagado to bind the value to a checkbox, but the console.log works fine but the property doesn't. I'm doing this:
consultar: function () {
that = this;
var usuariocreado = this.fbref('/yearmes/' + this.yearmes + '/' + this.usuario.$key);
usuariocreado.once('value')
.then(function (snapshot) {
var a = snapshot.exists();
console.log('exist in DB: ' + a);
if (a) {
console.log('The user exist: ' + a)
that.pagado = true;
} else {
console.log('The user doesn't exist: ' + a)
that.pagado = false;
}
});
},
And the final result, for example in this case all the checks must be active but only the last ones have the correct value. What is the best way to solve this? Thanks a lot for your comments:
Sorry was my mistake :( the problem was that I use a variable called: "that" but I din't use the word: VAR to declare it :( so that was my problem.
Thanks for your time :(