ember.js - ember.js - Ember {{#each}} helper not rendering - answerstu - answerstu.com answerstu

ember.js - Ember {{#each}} helper not rendering

I am fairly new to web development and I was trying to walk through the ember doc examples. Everything was working ok until I tried to use the {{#each}} helper. I don't see what I am doing wrong, am I using the right version of handlebars?

Here is inside my html:

<div>First element</div>
<div id="second-placeholder"></div>
<div>Third element</div>

<script type="text/x-handlebars" data-template-name="second-item-template">
    {{#each App.egosController}}
        <p>{{id}} - {{type}}</p>

And here is my controller:

App.egosController = Ember.ArrayController.create({
    content: [],
    init: function(){
        alert('Controller Initialised!');

App.egosController.set('content', [ego, alterEgo]);

    templateName: 'second-item-template'

jsfiddle here: http://jsfiddle.net/VqgMk/64/



2 Answers

  1. Phoebe- Reply


    The variable ego is not defined. Just replace ego with myEgo and it should work.

  2. Quentin- Reply


    As louiscoquio pointed out, my ego variable was not initialised. I guess I'll use the console next time.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>