brg
brg

Reputation: 3953

emberjs #each helper not producing any output even though the template was rendered

Though the "posts/index" template is rendering, the emberjs #each helper inside the template does not produce any output. this is the jsfiddle: http://jsfiddle.net/rxWzu/

I have tried this:

{{#each  post in content}}
 <p> {{post.title}} </p>
<p>{{#linkTo 'posts.post' post}} {{post.body}}  {{/linkTo}}</p>
{{/each}}

and this

{{#each controller}}
 <p>{{title}} </p>
 <p>{{#linkTo 'posts.post' post}} {{body}}  {{/linkTo}}</p>
{{/each}}

Thanks.

Upvotes: 1

Views: 124

Answers (1)

CraigTeegarden
CraigTeegarden

Reputation: 8251

You should use EmBlog.Post.find() in your model method for EmBlog.PostsIndexRoute.

EmBlog.PostsIndexRoute  = Ember.Route.extend({
  model: function(){
     return  EmBlog.Post.find();
  }
...

Also, you don't need to call setupController in either of your routes. The way you called it is the default in Ember.

JSFiddle example

Upvotes: 2

Related Questions