"Ember Way" of Populating Ember.Select

Hello,

I have an application that has a ListsController and ListsRoute that is used to display all of the “lists” in my application:

App.ListsRoute = Ember.Route.extend({
	model: function() {
		return App.List.find();
	}
});

I also have a Ember.Select in a view that is bound to an instance of Ember.ObjectController:

{{#each card in cards itemController="card"}}
    <div class="card">
        {{#if isEditing}}
            {{ view App.EditCardView }}

EditCardView looks like this:

<script type="text/x-handlebars" data-template-name="editCardView">
    {{ view Ember.TextField valueBinding="card.description" }}

    {{ view Ember.Select contentBinding = "??"
                         optionLabelPath = "model.listName"
                         optionValuePath = "model.id" 
                         prompt = "Select List..." }}
</script>  

The select needs to be populated with the same lists that are in the ListsRoute model. In most of the examples I’ve seen for the Ember.Select view another property is attached directly to the Application namespace, however I doesn’t seem like that’s the best way of doing it in my case since I already have a Route and a Controller for that data.

What would you suggest is the best way to populate the select with the same data that is already in my Lists route?

-Ryan

1 Like