I do not know why my templates are not being rendered in the named outlets. This is my first stab at learning ember and I am stuck on the named outlets.
I would like to render the sidebarTemplate in the {{outlet "sidebar"}}
and the contentTemplate in the {{outlet "content"}}
but I keep getting the following error in the console: "Error while processing route: posts Cannot read property 'connectOutlet' of undefined TypeError: Cannot read property 'connectOutlet' of undefined"
Here is a fiddle to my code: http://jsfiddle.net/va71wwr9/
Here is my HTML:
<script type="text/x-handlebars">
<div class="nav-container">
<ul class="nav">
<li>{{#link-to 'home'}}Home{{/link-to}}</li>
<li>{{#link-to 'posts'}}Posts{{/link-to}}</li>
</ul>
</div>
{{outlet}}
</script>
<script type="text/x-handlebars" id="home">
<h1>Home screen</h1>
</script>
<script type="text/x-handlebars" id="posts">
<h1>Posts screen</h1>
<div class="sidebar-container">
{{outlet sidebar}}
</div>
<div class="content-container">
{{outlet content}}
</div>
</script>
<script type="text/x-handlebars" id="sidebarTemplate">
<p>Side bar stuff</p>
</script>
<script type="text/x-handlebars" id="contentTemplate">
<p>content stuff</p>
</script>
Here is my JavaScript:
var App = Ember.Application.create();
App.Router.map(function() {
this.resource('home', {path: '/'});
this.resource('home', {path: 'home'});
this.resource('posts', {path: 'posts'});
});
App.PostsRoute = Ember.Route.extend({
renderTemplate: function() {
this.render('sidebarTemplate', {
into: 'posts',
outlet: 'sidebar'
});
this.render('contentTemplate', {
into: 'posts',
outlet: 'content'
});
}
});