Note that there are some explanatory texts on larger screens.

plurals
  1. POContainerView not connecting childviews and controller properly
    primarykey
    data
    text
    <p>I have an container view defined below</p> <pre><code>app.MainView = Ember.ContainerView.extend({ childViews: ['navigationView', 'gutterView', 'mainView'], elementId: 'master', navigationView: app.NavView, gutterView: app.GutterView, mainView: Ember.View.create({ elementId: 'content', template: Ember.Handlebars.compile('{{outlet contentOutlet}}') }) }); app.NavView = Ember.View.extend({ elementId: 'main-menu', classNames: ['navigationPanel'], template: Ember.Handlebars.compile('{{controller}}') }); app.NavController = Ember.ArrayController.extend({ content: [], }); </code></pre> <p>the problem here is that when I define it like this the controller for app.NavView (app.NavController) does not get connected to the view. if I look at the {{controller}} for the NavView through the template i get the ApplicationController.</p> <p>But when I define it like this:</p> <pre><code> app.MainView = Ember.ContainerView.extend({ childViews: ['navigationView', 'gutterView', 'mainView'], elementId: 'master', navigationView: Ember.View.extend({ elementId: 'nav', template: Ember.Handlebars.compile('{{outlet navOutlet}}') }), gutterView: app.GutterView, mainView: Ember.View.create({ elementId: 'content', template: Ember.Handlebars.compile('{{outlet contentOutlet}}') }) }); </code></pre> <p>and connect the NavView through the connectOutlet in the router </p> <pre><code>router.get('applicationController').connectOutlet('navOutlet', 'nav'); </code></pre> <p>I get that the connected controller in NavView is NavController, which is correct!</p> <p><strong>The question is, what am I missing here? I don't want an outlet here and want it to be created through the mainView. Why is Ember not connecting the View and Controller properly when I use an ContainerView?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload