Skip to content

Instantly share code, notes, and snippets.

@amiuhle
Last active August 29, 2015 14:01
Show Gist options
  • Save amiuhle/ad8caf857140959abc19 to your computer and use it in GitHub Desktop.
Save amiuhle/ad8caf857140959abc19 to your computer and use it in GitHub Desktop.
input fields in polymer
<polymer-element name="my-checkbox" attributes="name value checked">
<template> <!-- main template, renders to shadow root --></template>
<template id="foo">
<input type="hidden" name="{{name}}" value="{{checked ? value : 0}}" />
</template>
<script>
(function() {
Polymer('my-checkbox', {
ready: function() {
// this.element is `polymer-element`
var template = this.element.querySelector('#foo');
// set up the magic to use bindings
var dom = this.instanceTemplate(template);
// will be appended outside of shadow root
this.appendChild(dom);
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment