How can I retreive the "current instance" of my view (defined as TextView
) in Ember.js app?
If I get it correctly, the router manages instantiating textView
with correct context (I can access it in the handlebars template as {{content}}
). Basically, I have several contacts in my messaging app and I need to hold array of messages for each of them.
View:
App.TextView = Ember.View.extend({
templateName : 'text',
messages : [],
});
Router:
send : Ember.Route.extend({
route:'/send',
connectOutlets:function (router) {
var conversationController = router.get('conversationController'),
contact = conversationController.get('content');
// contact is my context, it's ok here
conversationController.connectOutlet('text', contact);
}
)};
When connectOutlets
is called on the conversationController
controller, a TextView
is created and set as a property on the conversationController
, with the name of the Outlet:
If the Outlet has no name, it will be called "view":