Reversing an array of content

I keep a list of lookups in my ArrayController. I would like the search terms to be displayed as the oldest. By default, Ember displays them in order.

You can see my current implementation here:

And here is the relevant code.

{{#each App.recentUsersArray.reverse}}
        <a href="#" title="view again" {{action "searchAgain" target="App.recentUsersArray"}}>{{this}}</a>

App.recentUsersArray = Em.ArrayController.create({
    content: [],
    reverse: function(){
        return this.content.reverse();


You can see that I am trying to change it using the property () method, but it doesn't work. Am I doing something wrong?


source to share

1 answer

You should always use get

and set

to access properties. Also, if the computed property depends on others, you must add them to your declaration property

. Usage cacheable

may be dropped in next version of ember, see discussion . You can see a working example here .

reverse: function(){
    return this.get('content').toArray().reverse();


You can also use method unshiftObject

on array and work around computed property creation, see .



All Articles