Skip to content

Instantly share code, notes, and snippets.

@sgharms
Created April 16, 2012 16:42
Show Gist options
  • Save sgharms/2399873 to your computer and use it in GitHub Desktop.
Save sgharms/2399873 to your computer and use it in GitHub Desktop.
{{ view Ember.Select
contentBinding="Sorter.SortController.options"
optionLabelPath="content.label"
optionValuePath="content.value"
prompt="Sort some numbers..."
selectionBinding="Sorter.SortController.selected"
}}
But I want to say...
{{view Myapp.MySelect }} // such that it has all the bindings as above.
@sgharms
Copy link
Author

sgharms commented Apr 16, 2012

Like:

Sorter.mySelectView = Ember.Select.extend({
options: [
{label : 'uno', value: 'one' },
{label : 'dos', value: 'two' },
]
})

@wagenet
Copy link

wagenet commented Apr 16, 2012

I would recommend this:

MyApp.MySelect = Ember.Select.extend({
  target: null,
  contentBinding="target.options",
  selectionBinding="target.selected",
  optionLabelPath="content.label",
  optionValuePath="content.value",
  prompt: "Sort some numbers..."
});

then

{{view MyApp.MySelect targetBinding="Sorter.SortController"}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment