ember.js - Error: an Ember.CollectionView's content must implement Ember.Array. -


i want render template render helper. page take error:

an ember.collectionview's content must implement ember.array

http://jsbin.com/ikituj/62/edit

the render helper

first, 1 minor change. when call {{render "blogcategory" app.blogcategory}}, should (optionally) passing instance of blogcategory model second parameter render, not class. see more on render helper

the error

so, changing line {{render "blogcategory"}}, still error:

uncaught error: assertion failed: ember.collectionview's content must implement     ember.array. passed <(generated blogcategory controller):ember326>  

why happening?

this because ember not picking on blogcategorycontroller. see how error says you're passing in (generated blogcategory controller)? means ember has auto-generated controller -- not blogcategorycontroller defined (which extends arraycontroller , does implement ember.array).

when call {{render 'blogcategory'}} in blogs template, convention, ember looks view named blogcategory , controller named blogcategorycontroller. notice capitalization -- ember doesn't know when capitalize classes you! because can't find either, autogenerates objectcontroller, , complains when try iterate on {{#each}} in blogcategory template.

the fix

the solution either change render call or controller name match. went changing call render because controller name (blogcategorycontroller) follows convention.

  1. i changed {{render 'blogcategory'}} {{render 'blogcategory'}}
  2. i changed id on blogcategory template id=blogcategory.

see here: http://jsbin.com/ikituj/66/edit


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -