Referring the example for the NoteApp
When fab is clicked and the note is saved, then in the database in Firebase console and the data is added under the main child rather then at /notes/user-id/.
Help me with this issue.
<link rel="import" href="bower_components/note-app-elements/na-elements.html">
<link rel="import" href="bower_components/app-storage/app-indexeddb-mirror/app-indexeddb-mirror.html">
<link rel="import" href="bower_components/polymerfire/polymerfire.html">
<dom-module id="note-app">
<template>
<style include="note-app-shared-styles"></style>
<na-toolbar
signed-in="[[signedIn]]"
on-sign-out="signOut">
</na-toolbar>
<na-login
on-sign-in="signIn"
signed-in="[[signedIn]]"
disabled="[[!online]]">
</na-login>
<firebase-auth
id="auth"
app-name="linkshare"
provider="google"
signed-in=""
user="">
</firebase-auth>
<paper-fab
icon="add"
on-tap="create"
disabled="[[!online]]"
aria-label="Add note">
</paper-fab>
<na-editor
id="editor"
note=""
on-close="commitChange">
</na-editor>
<firebase-document
id="document"
app-name="linkshare"
path="[[editableNoteId]]"
data="">
</firebase-document>
<firebase-query
id="query"
app-name="linkshare"
path="/notes/[[user.uid]]"
data="">
</firebase-query>
<app-indexeddb-mirror
session="[[user.uid]]"
key="notes"
data=""
persisted-data="">
</app-indexeddb-mirror>
<div class="notes">
<template is="dom-repeat" items="[[persistedNotes]]" as="note">
<na-note
id$="[[note.$key]]"
title="[[note.title]]"
body="[[note.body]]"
on-tap="edit">
</na-note>
</template>
</div>
</template>
<script>
Polymer({
is: 'note-app',
behaviors: [Polymer.NoteAppBehavior],
signIn: function() {
this.$.auth.signInWithPopup();
},
save: function() {
this.$.document.saveValue();
},
get notesPath() {
return '/notes/' + this.user.uid;
},
toEditableId: function(noteId) {
return this.notesPath + '/' + noteId;
},
get isEditable() {
return this.online;
}
});
</script>
</dom-module>
Aucun commentaire:
Enregistrer un commentaire