我正在用聚合物构建一个网络应用程序,并且我使用firebase作为数据库。我想建立一个用户电子邮件构图网站。当网站打开->时,应该更新一个简单的防火墙节点。我的电子邮件-确认email:
<dom-module id="email-confirmation">
<template>
<firebase-document
id="idd"
location="[[location]]"
data="{{userToConfirm}}"
on-data-changed="callMe">
</firebase-document>
<template is="dom-if" if="{{isConfirmed(userToConfirm)}}">
<p>It worked!</p>
</template>
</template>
<script src="./email-confirmation.js"></script>
</dom-module>我的电子邮件-确认. my:
class EmailConfirmation {
beforeRegister() {
this.is = 'email-confirmation';
this.properties = {
/**
* Defines the email, that will be confirmed.
*/
email: {
type: String
}
};
this.observers = [
// Note that this function will not fire until *all* parameters
// given have been set to something other than `undefined`
'attributesReady(email)'
];
}
attributesReady(email) {
this.location = document.createElement('iron-meta').byKey('firebaseLocation') + 'users/' + email;
}
isConfirmed(bla) {
this.userToConfirm.confirmed = true;
bla.confirmed = true;
return true;
}
callMe(event, values) {
this.userToConfirm.confirmed = true;
event.detail.value.confirmed = true;
event.currentTarget.data.confirmed = true;
this.$.idd.data = true;
values.value.confirmed = true;
}
}正如你所看到的,我试图在这里使用不同的方法。但是这些调用实际上都没有更新我的firebase节点!如何用javascript更新我的节点?
我还认为,通知firebase文档时可能会出现问题,即值已经更改。我试着启动一个事件,但他们似乎没有达到防火文件。(可能是因为这些事件没有向孩子们开火)
亲切问候马克
发布于 2015-10-26 14:32:55
尝试使用query属性this.$.idd.query.set('confirmed', true);
https://stackoverflow.com/questions/33332498
复制相似问题