0

Hi I have in Firebase a document with a list of users and another with this structure:

Data in firebase

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 apears there, I have a property wich I call: pagado to bind the value to a checkbox, but the console.log works fine but the property doesnt :( I im 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 one have the correct value :( , how is the best way to solve this? , thanks a lot for your coments:

enter image description here

1 Answers1

0

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 :(