【问题标题】:Polymer-firebase: show with polymer specific data in firebasePolymer-firebase:在 firebase 中显示聚合物特定数据
【发布时间】:2016-12-09 20:48:23
【问题描述】:

您好,我在 Firebase 中有一个包含用户列表的文档和另一个具有这种结构的文档:

在“父亲”组件中,我获得了所有用户:

<template is="dom-repeat" items="{{usuarios}}" as="usuario">

        <admin-consulta-pagos-item usuario="{{usuario}}" yearmes="{{yearmes}}" id="consultaspagos"></admin-consulta-pagos-item>
    </template>

然后我调用“子”组件,如果用户出现在那里,我需要做的是在特定的 year_month 中搜索,我有一个我调用的属性:pagado 将值绑定到复选框,但控制台.log 工作正常,但属性不 :( 我正在这样做:

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;
            }
        });
    },

最终结果,例如在这种情况下,所有检查都必须处于活动状态,但只有最后一项具有正确的值 :( ,解决这个问题的最佳方法是什么?非常感谢您的评论:

【问题讨论】:

    标签: polymer firebase-polymer


    【解决方案1】:

    抱歉是我的错误 :( 问题是我使用了一个名为“that”的变量,但我没有使用这个词:VAR 来声明它 :( 所以这是我的问题。

    感谢您的宝贵时间:(

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多