Created
March 9, 2015 19:20
-
-
Save ryanisinallofus/177b5e09a0fa5d63146f to your computer and use it in GitHub Desktop.
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
<!-- Define element --> | |
<polymer-element name="my-counter" attributes="counter"> | |
<template> | |
<style> /*...*/ </style> | |
<div id="label"><content></content></div> | |
Value: <span id="counterVal">{{counter}}</span><br> | |
<button on-tap="{{increment}}">Increment</button> | |
</template> | |
<script> | |
Polymer({ | |
counter: 0, // Default value | |
counterChanged: function() { | |
this.$.counterVal.classList.add('highlight'); | |
}, | |
increment: function() { | |
this.counter++; | |
} | |
}); | |
</script> | |
</polymer-element> | |
<!-- Use element --> | |
<my-counter counter="10">Points</my-counter> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment