2

I'm trying to save data into firebase database but always run into TypeError. Can't seem to find what the issue is. Here is my <template> code:

<firebase-auth
    id="auth"
    app-name="notes"
    provider="google"
    signed-in="{{signedIn}}"
    user="{{user}}">
</firebase-auth>

<firebase-document
    id="document"
    app-name="notes"
    path="[[editableNoteId]]"
    data="{{editableNote}}">
</firebase-document>

<na-editor
    id="editor"
    note="{{editableNote}}"
    on-close="commitChange">
</na-editor>

Script:

<script>
  Polymer({
    is: 'note-app',

    behaviors: [Polymer.NoteAppBehavior],

    signIn: function() {
      this.$.auth.signInWithPopup();
    },

    get notesPath() {
      return '/notes/' + this.user.uid;
    },

    toEditableId: function(noteId) {
      return this.notesPath + '/' + noteId;
    }
  });
</script>

Here is the error:

TypeError: this.$.document.save is not a function. (In 'this.$.document.save(this.notesPath)', 'this.$.document.save' is undefined)

NOTE: The app-name and firebase-app have been defined correctly.

  • I am also trying from android app but nothing happen same code was working today when i go to console the database is not loading may be their servers down or something else happen – Muhammad Younas Apr 17 '17 at 10:06

2 Answers2

3

In version 0.11.0 the save() method was renamed to saveValue() to maintain compatibility with certain JS compilers and older browsers. See the release notes for details.

The docs are now also showing the update, but may not have been when you looked at them.

Michael Bleigh
  • 25,334
  • 2
  • 79
  • 85
1

Adding this to the script fixed the issue.

save: function() {      
    this.$.document.saveValue();
},