How does viewName work?

Hi all,

I’m wondering how does passing a viewName to the {{view…}} helper work.

I’ve tried to read the source code but couldn’t find anything obvious so far.

Can you guys give me some advise on it?

Passing the viewName option to a handlebars helper:

{{view Ember.view viewName='myViewInstance'}}

When does it ‘register’ this view instance to the controller, so that, calling this.get('myViewInstance') inside the controller returns the view instance.

I’ve been working on several projects using Ember.js. The wired thing is that passing viewName in the HBS helper does not guarantee the access of that view from the controller. Sometimes it works but sometimes not. So I want to have a read of the related source code to have a deeper understanding.

Thanks.