If you pass more than one argument to the each helper, it must be in the form #each foo in bar

199 Views Asked by At

I'm using Ember 1.10.0, Ember Data beta 14.1, and Ember LocalStorage Adapter 0.5.1. I have a template:

<h1>Dracula's blog</h1>

<ul>
  {{#each post in model}}
    <li>{{#link-to 'post' post}}{{post.title}}{{/link-to}}</li>
  {{/each}}
</ul>

{{#link-to 'new-post' classNames="btn btn-primary"}}New scary post{{/link-to}}

A route:

Blogger.PostsRoute = Ember.Route.extend({
  model: function() {
    return this.store.find('post');
  }
});

And am relying on Ember automatically creating an ArrayController based on an array of models being returned.

When I load the route, I get the error:

Uncaught Error: Assertion Failed: If you pass more than one argument to the each helper, it must be in the form #each foo in bar

If I switch to the {{#each model as |post|}} or {{#each model}} form, I don't get an error (except for a deprecation warning on the second form).

1

There are 1 best solutions below

0
On BEST ANSWER

I just figured out that I was still compiling templates using Ember.Handlebars.precompile(template);, which I'm shocked worked at all! Switching to Ember.HTMLBars.compile(template); fixed the issue. Thanks for all of the helpful comments, especially @Kalman - trying to reproduce in jsbin led me to the solution.