vendredi 14 octobre 2016

Polymer 1.0 is there a way to easily pass all default parameters to a template element

I want to pass all attributes to 1 or ore new elements of a native HTML element.

<dom-module id="clear-filter-button">
    <template>
        <button type="button" id=[[id]] class=[[class]]....></button>
    </template>
 </dom-module>

I want to do this but without having to add in all the attributes one by one. I know you can simply extend an element, but that doesn't help if I wan't to something more involved, like surround the button with a div or setup default values.

A more concrete example: I want to create a custom button that will have a built in function (foo) when the button is clicked and a default value for the text on the button.

Aucun commentaire:

Enregistrer un commentaire