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()
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.
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.
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.