Skip to content

Instantly share code, notes, and snippets.

@cloke
Created August 13, 2013 23:27
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/6226712 to your computer and use it in GitHub Desktop.
Save cloke/6226712 to your computer and use it in GitHub Desktop.
#In template
{{tb-select options=controllers.menus.pods value=pod}}
#Work in progress
Ember.TEMPLATES['components/tb-select'] = Em.Handlebars.compile '
<div class="controls">
{{view view.OptionsView}}
</div>
'
M.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}}
'
valueDidChange: ( ->
@$('select').val @get 'value'
).observes 'value'
didInsertElement: ->
@$('select').val @get 'selected'
change: ->
@set 'value', @$('select').val()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment