Created
January 7, 2014 15:30
-
-
Save krisselden/8301014 to your computer and use it in GitHub Desktop.
Simple example of an template-less Ember component. Requires https://gist.github.com/kselden/7586144 to add min/max to input helper
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
var ColorRectComponent = Ember.Component.extend({ | |
width: 100, | |
height: 100, | |
r: 0, | |
g: 0, | |
b: 0, | |
color: function () { | |
return 'rgb('+this.get('r')+','+this.get('g')+','+this.get('b')+')'; | |
}.property('r','g','b'), | |
attributeBindings: ['style'], | |
style: function () { | |
return 'background-color:' + | |
this.get('color')+'; width: '+ | |
this.get('width')+'px; height: '+ | |
this.get('height')+'px'; | |
}.property('color', 'width', 'height') | |
}); | |
export default ColorRectComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment