0

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.

AL.
  • 36,815
  • 10
  • 142
  • 281
Munish Kapoor
  • 3,141
  • 2
  • 26
  • 41

1 Answers1

0

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>
Munish Kapoor
  • 3,141
  • 2
  • 26
  • 41