Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Can't create custom more info card

$
0
0

@marcomartins wrote:

Hello,

I’m trying to create a new more info card but I’m getting an error extending Polymer.Element, If I past the script on the browser console, it works, but when I’m loading the component I get Uncaught TypeError: Class extends value undefined is not a constructor or null

My code:


<dom-module id='more-info-plant'>
  <template>
    <style>

    </style>
    <textarea>[[_toStr(stateObj)]]</textarea>
  </template>
</dom-module>

<script>
  class MoreInfoPlant extends Polymer.Element {
    static get is() { return 'more-info-plant'; }

    static get properties() {
      return {
        // Home Assistant object
        hass: Object,
        // inDialog is true if shown as more-info-card
        inDialog: {
          type: Boolean,
          value: true,
        },
        // includes state, config and more information of the entity
        stateObj: Object,
      };
    }

    _toStr(obj) {
      return JSON.stringify(obj, null, 2);
    }
  }

  customElements.define(MoreInfoPlant.is, MoreInfoPlant);
</script>

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles