ember.jshandlebars.jsember-app-kit

Ember App Kit: Cannot find viewClass for template outlet


I've got my application.hbs template where I declare several {{outlet}}s (named & unnamed) and one with specified viewClass property:

application.hbs:

{{outlet 'modal'}}
{{outlet 'notification'}}
<h1>EAK Application</h1>
{{#view 'application/content'}}
  {{!some HTML markup, etc. }}

  {{outlet viewClass='application/content-container'}}
{{/view}}

and my view files are placed under

app/views/application/content.js
app/views/application/content-container.js

But Ember App Kit cannot find the content-container view!

Uncaught Error: Assertion Failed: Unable to find view at path 'views/application/content-container'

Am I doing something wrong?

Edit


Meanwhile I do the simple workaround and call it like

{{#view 'application/content-container'}}
  {{outlet}}
{{/view}}

but this gives my an extra <div> layer and is "less elegant" imho...


Solution

  • The current Ember API reference (http://emberjs.com/api/classes/Ember.Handlebars.helpers.html#method_outlet) says the property on the outlet should be view not viewClass:

    {{#view 'application/content'}}
      {{!some HTML markup, etc. }}
    
      {{outlet view='application/content-container'}}
    {{/view}}
    

    Without a full understanding of the app your building, I can't make a specific recommendation, but if you want to take advantage of the deep linking URLs, you should use routes when possible to assign templates/views to outlets.

    For example your IndexRoute will expect an IndexTemplate and an IndexView (or will create one behind the scenes). In the Ember App Kit they would be located in app/views/index.js and app/templates/index.hbs. Check out the Rendering a Template guide on Ember's site: http://emberjs.com/guides/routing/rendering-a-template/

    Alternatively you could also use the view helper like:

    {{view 'my-view'}}

    The is different than the normal Ember view helper where the view helper expects the actual class. In the Ember App Kit, it's the path to the file based on the file name and path of the view from the app/views root.