# Populating ember.select of parent objects

**URL:** <https://discuss.emberjs.com/t/populating-ember-select-of-parent-objects/6671>\
**Category:** Uncategorized\
**Created:** [November 11, 2014, 11:44pm UTC](https://discuss.emberjs.com/t/populating-ember-select-of-parent-objects/6671 "2014-11-11T23:44:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexpereda](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@alexpereda](https://discuss.emberjs.com/u/alexpereda)\
**Post date:** [November 11, 2014, 11:44pm UTC](https://discuss.emberjs.com/t/populating-ember-select-of-parent-objects/6671/1 "2014-11-11T23:44:50Z")

</div>

I have been trying to populate an select option list of available parent objects. I’m not using Ember-Data or any other data framework, I’m loading ajax into standard Ember.Object. I load a list of chapters which will have events attached to them. I want to create a new event, but want the user to have the option of selecting the chapter in the add event template. for this I want to fill a select box with chapter tittles and ids as the value.

I can’t get this to work.

I tried creating a computed property called chapters, that returned the chapters

```
chapters: function (){
    return App.ChaptersModel.findAll();
}.property()

```

In the template I do this:

```
 {{view Ember.Select content=chapters optionValuePath="content.id" optionLabelPath="content.title"}}

```

this does not seem to work for me.

I don’t get errors, but the list is empty.

Thanks in advance for any advice.

---

<div class="post-metadata">

**Author:** ![cigoe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/cigoe/32/15728_2.png) [@cigoe](https://discuss.emberjs.com/u/cigoe)\
**Post date:** [November 12, 2014, 2:00am UTC](https://discuss.emberjs.com/t/populating-ember-select-of-parent-objects/6671/2 "2014-11-12T02:00:23Z")

</div>

Is there a reason you are making chapters a property that is observing nothing instead of loading them when the controller or route is instantiated? If ‘chapters’ is a static resource it may be more efficient loading them in setupController on the route and then binding the select to the property on the controller.

---

<div class="post-metadata">

**Author:** ![alexpereda](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@alexpereda](https://discuss.emberjs.com/u/alexpereda)\
**Post date:** [November 12, 2014, 7:18am UTC](https://discuss.emberjs.com/t/populating-ember-select-of-parent-objects/6671/3 "2014-11-12T07:18:14Z")

</div>

The route that serves the template will fill the following

title date body status parent\_chapter.

I preset a template with via the AuthorNeweventRoute,

the chapters need to be available on this route or controller, so I though. Can a route have more than one model? or controller? I don’t fully understand the setupController’s function.

This is the route to add an event:

```
App.AuthorNeweventRoute = Ember.Route.extend({
    model: function(){
        return {
            title: 'New Title',
            status: 'Draft',
            periodStart: '12/12/1994',
            body: 'some html coopy'            
        }
    }
});

```

And this is the controller that I thought might work with the chapter’s property.

```
App.AuthorNeweventController = Ember.ObjectController.extend({
chapters: function(){
         return App.ChaptersModel.findAll();
     }.property(),
})

```

Before the user hits the add event action, they are sitting on a list of chapters, that get loaded via another route. But the add event route is not nested inside this route, I was thinking that I probably should nest them. I was going to try that next.

I’m just starting with ember, and some of the concepts are not sinking in yet.

thanks for the help.

---

<div class="post-metadata">

**Author:** ![alexpereda](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@alexpereda](https://discuss.emberjs.com/u/alexpereda)\
**Post date:** [November 13, 2014, 3:12am UTC](https://discuss.emberjs.com/t/populating-ember-select-of-parent-objects/6671/4 "2014-11-13T03:12:24Z")

</div>

I got this to work using the setupController() method. took a while, but I think I understand why it is needed.

Thanks.
