Last active
August 29, 2015 14:01
-
-
Save amiuhle/ad8caf857140959abc19 to your computer and use it in GitHub Desktop.
input fields in polymer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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