Using latest ember.js build, I’m trying to use a controller action to create a childView and push it into the current view. But I can’t figure out how to talk to the associated view.
In my search.handlebars:
<p>Results:</p>
{{#each animal in someResults}}
<li><a {{action showAnimal animal}}>{{animal.species.commonName}}</a></li>
{{/each}}
In App.SearchController, I have:
showAnimal: function(animal) {
// Now what?? The below is obviously wrong
this.animalView = App.AnimalView.create({controller: animal});
var childView = App.SearchView.createChildView(this.animalView);
App.SearchView.get('childViews').pushObject(childView);
}
The objects visible from within showAnimal are:
animal– ok finethis.container– don’t see anything helpful in herethis.target– seemingly the router?
Anyway, I’m baffled. Any help appreciated.
Recognizing my question was a bit arcane / situation specific, here is what I ultimately did in case anyone cares. Note that some APIs have subsequently changed.
Recall that I’m trying to get a jQuery UI dialog to popup in my current view. Luke Melia’s great article on this topic was the basis for my original approach.
In handlebars:
Then in App.SearchView:
And just for completeness, here’s the AnimalView.