Last active
December 21, 2015 14:59
-
-
Save cloke/6323765 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
#in template | |
{{tb-select value=market_po options=controllers.menus.markets}} | |
#Work in progress | |
Ember.TEMPLATES['components/tb-select'] = Em.Handlebars.compile ' | |
{{view view.OptionsView}} | |
' | |
Binders.TbSelectComponent = Ember.Component.extend | |
OptionsView: Em.CollectionView.extend | |
tagName: 'select' | |
valueBinding: 'parentView.value' | |
contentBinding: 'parentView.options' | |
itemViewClass: Em.View.extend | |
attributeBindings: ['value'] | |
valueBinding: 'content' | |
template: Em.Handlebars.compile ' | |
{{view.content}} | |
' | |
didInsertElement: -> | |
@$('select').val( @get 'value' ) | |
valueDidChange: ( -> | |
@$('select').val( @get 'value' ) | |
).observes 'value' | |
change: -> | |
@set 'value', @$('select').val() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment