Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm following the official TodoMVC tutorial from Ember.js website. Everything works until the step to display model data: http://emberjs.com/guides/getting-started/displaying-model-data/

The error I'm getting is Uncaught Error: assertion failed: an Ember.CollectionView's content must implement Ember.Array. You passed <(generated application controller):ember280> when trying to access each element in the controller with {{#each controller}} as instructed.

The error disappeared when I changed it into {{#each controller.content}}. However, nothing was displayed. The documentation said that

This controller is an instance of ArrayController that Ember.js has provided for us as the container for our models

and the API listed length as a property of the ArrayController class. But when I tried to {{log controller.length}} and {{log controller.content.length}}, I got undefined as the result.

All this suggested that controller is not an instance of the Array Controller class, at least not anymore. So how can I display my model data now?

Thanks!!!

share|improve this question

1 Answer

up vote 0 down vote accepted

Yeah you are right, the ArrayController has a length property which returns the length of its content....The content property of an ArrayController should be an array...

sample working fiddle

http://jsbin.com/ikijoq/1/edit

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.