# ArrayController sorting with #each item in model

**URL:** <https://discuss.emberjs.com/t/arraycontroller-sorting-with-each-item-in-model/5338>\
**Category:** Uncategorized\
**Created:** [May 21, 2014, 9:34am UTC](https://discuss.emberjs.com/t/arraycontroller-sorting-with-each-item-in-model/5338 "2014-05-21T09:34:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![robinhoudmeyers](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/robinhoudmeyers/32/15201_2.png) [@robinhoudmeyers](https://discuss.emberjs.com/u/robinhoudmeyers)\
**Post date:** [May 21, 2014, 9:34am UTC](https://discuss.emberjs.com/t/arraycontroller-sorting-with-each-item-in-model/5338/1 "2014-05-21T09:34:49Z")

</div>

I am defining sort properties _sortAscending_ and _sortProperties_ in an ArrayController. When I render the model with `{{#each}}` the sorting works.

The problem (or the thing I’m not understanding) is when I use `{{#each item in model}}`. In this case the sorting gets overridden or just ignored. Is this normal behaviour and am I missing something out?

---

<div class="post-metadata">

**Author:** ![rainerfrey](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@rainerfrey](https://discuss.emberjs.com/u/rainerfrey)\
**Post date:** [May 21, 2014, 11:08am UTC](https://discuss.emberjs.com/t/arraycontroller-sorting-with-each-item-in-model/5338/2 "2014-05-21T11:08:23Z")

</div>

Um … yes you are missing something. The sorting properties that you define in the controller are applied in the controller. Thus they are not applied when you access the model directly.

If your intention simply is to have an item variable, you can use `{{#each item in controller}}`.

---

<div class="post-metadata">

**Author:** ![robinhoudmeyers](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/robinhoudmeyers/32/15201_2.png) [@robinhoudmeyers](https://discuss.emberjs.com/u/robinhoudmeyers)\
**Post date:** [May 21, 2014, 11:41am UTC](https://discuss.emberjs.com/t/arraycontroller-sorting-with-each-item-in-model/5338/3 "2014-05-21T11:41:16Z")

</div>

Ok, thats great. Do you know any place where I can read up on this topic?

---

<div class="post-metadata">

**Author:** ![rainerfrey](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@rainerfrey](https://discuss.emberjs.com/u/rainerfrey)\
**Post date:** [May 21, 2014, 2:01pm UTC](https://discuss.emberjs.com/t/arraycontroller-sorting-with-each-item-in-model/5338/4 "2014-05-21T14:01:59Z")

</div>

Hm … Controller guides show the general idea of accessing the model properties through controller properties instead of directly. I couldn’t easily find the fact that the controller itself is available as variable `controller` though. The ArrayController guide shows the sorting stuff (that shows that it’s a controller functionality).

I remember when I began with Ember you’d find examples with `{{#each controller}}` everywhere, but current guides have replaced them with `{{#each}}`. In the ArrayController API docs are still hints though.
