Skip to content

Instantly share code, notes, and snippets.

@cloke
Last active December 21, 2015 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloke/6323765 to your computer and use it in GitHub Desktop.
Save cloke/6323765 to your computer and use it in GitHub Desktop.
#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