从“在中重复dom”对话框编辑firebase对象
我正在尝试编辑图纸对话框中集合中的firebase对象 我正在访问e.model对话框按钮的点击功能中的对象。但是我如何从对话框中回写它呢从“在中重复dom”对话框编辑firebase对象,firebase,polymer-1.0,Firebase,Polymer 1.0,我正在尝试编辑图纸对话框中集合中的firebase对象 我正在访问e.model对话框按钮的点击功能中的对象。但是我如何从对话框中回写它呢 <firebase-collection id="fbAccounts" location="https://xxx.firebaseio.com/accounts" data="{{accounts}}"> </firebase-collection> 请提供一些代码
<firebase-collection id="fbAccounts"
location="https://xxx.firebaseio.com/accounts"
data="{{accounts}}">
</firebase-collection>
请提供一些代码片段,以便更容易地帮助您:感谢您提供代码,但您如何“选择”要编辑的帐户?我在代码中看不到您在openEditDialog中“选择”实际帐户的位置。我有一个存储在数据中的e.model对象。@JoergHerbarth您使它工作了吗?我使用dom重复显示项目,然后使用对话框进行编辑。在阵列中实时编辑,但在firebase中不更新
<paper-icon-button icon="editor:mode-edit" on-click="openEditDialog"></paper-icon-button>
<paper-dialog id="editContact">
<h2>Edit Account</h2>
<paper-input id="companyname" label="Company Name" value="{{data.accounts.name}}"></paper-input>
<paper-input id="street" label="Street" value="{{data.accounts.street}}"></paper-input>
<div class="horizontal layout">
<paper-input id="postalcode" label="Postal Code" size="8" value="{{data.accounts.postalcode}}"></paper-input>
<paper-input id="city" style="padding-left: 12px" label="City" value="{{data.accounts.city}}"></paper-input>
</div>
<paper-input id="country" label="Country" value="{{data.accounts.country}}"></paper-input>
<div class="buttons">
<paper-button dialog-dismiss>Cancel</paper-button>
<paper-button dialog-confirm on-click="saveEditAccount">Save</paper-button>
</div>
</paper-dialog>
Polymer({
is: 'accounts-view',
properties: {
data: {
type: Object,
notify: true
}
},
openEditDialog: function(e) {
this.data = e.model;
this.$.editContact.open();
},
deleteAccount: function(e) {
this.$.fbAccounts.remove(this.data.accounts);
},
saveEditAccount: function() {
var account = this.$.fbAccounts.getByKey(this.data.accounts.__firebaseKey__);
console.log(account);
});
}
});