Error while processing route: content.slice is not a function


#1

I have the following link defined in a template:

<div class="list-group">
    {{#each}}
        {{#link-to 'item' this class="list-group-item"}}
            {{received}} {{subject}}
        {{/link-to}}
    {{/each}}
</div>

Why am I getting the following error when I click on this link?

Error while processing route: item" "content.slice is not a function" "__exports__.default<.arrangedContent<@http://localhost:8000/js/libs/ember-1.8.1.js:33419:21

These are the versions I am using:

"DEBUG: -------------------------------"
"DEBUG: Ember      : 1.8.1"
"DEBUG: Ember Data : 1.0.0-beta.11"
"DEBUG: Handlebars : 1.3.0"
"DEBUG: jQuery     : 1.10.2"
"DEBUG: -------------------------------"

Looking into the code, this is where things blow up:

...
arrangedContent: computed('content', 'sortProperties.@each', function(key, value) {
    var content = get(this, 'content');
    var isSorted = get(this, 'isSorted');
    var sortProperties = get(this, 'sortProperties');
    var self = this;

    if (content && isSorted) {
        content = content.slice(); <== BOOM!
        ...

#2

I’m having the same problem - upgrading to Ember 1.8 and encountered this error (without having any problems before). Any chance you worked out the solution?

Suspect I’m doing something in my code I’m not meant to be doing, but can’t figure it out.


#3

Sorry, but never got any help with this one and don’t know any more what/if I did to fix it.

I suspect it has something to do with

{{#each}}

which it is now recommended to be used instead like this:

{{#each post in posts}}

Hope this helps.