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
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.
- i changed
{{render 'blogcategory'}}
{{render 'blogcategory'}}
- i changed id on
blogcategory
templateid=blogcategory
.
see here: http://jsbin.com/ikituj/66/edit
Comments
Post a Comment