0
votes

I am trying to save Firebase document using following code:

<dom-module id="my-view1">

<template>

    <firebase-document
        id="doc"
        app-name="manishkpr"
        data="{{category}}">

    </firebase-document>

    <paper-button class="font-normal" on-tap="save">save</paper-button>

</template>

<script>

 Polymer({
  is: 'my-view1',

  save:function (e) {
      this.$.doc.save("categories/",{ "name": 's' } );
  }

 });

</script>

I am getting this error:

enter image description here

Please help me.

1
Your not defining any data this.$.doc.data = {name: 's'};Snewedon
thanks it's workingMunish Kapoor

1 Answers

0
votes

I haven't set this.$doc.data = {name:'s'} as suggested by @Dale Snowdon

Here is updated code and it's working fine

<dom-module id="my-view1">

<template>

<firebase-document
    id="doc"
    app-name="manishkpr"
    data="{{category}}">

</firebase-document>

<paper-button class="font-normal" on-tap="save">save</paper-button>

</template>

<script>

Polymer({
  is: 'my-view1',

  save:function (e) {
     this.$doc.data = {name:'s'};
     this.$.doc.save("categories/");
}

});

</script>