When I do
var bob = App.MyModel.create().setProperties({ name: "bob marley" });
router.get('applicationController').connectOutlet('my', bob);
The instance of MyModel becomes the content property of the MyController instance. From what I read in the guide, the controller instance becomes the context for the handlebars template rendered by MyView.
Does that mean I always have to prefix the model’s properties with content. in the templates?
<h1>{{content.name}}</h1>
is there something I’m missing or is this the correct way of doing it?
If
App.MyControllerextendsEmber.ObjectController, then you should be able to use{{name}}directly. This is becauseEmber.ObjectControllerextendsEmber.ObjectProxy, rendering thecontentreference unnecessary.If you’re using
Ember.Controller, however, you’ll have to prefix the properties withcontent.like you said. For more details, see @trek’s controller documentation that was recently committed.