# Computed property in model hook

**URL:** <https://discuss.emberjs.com/t/computed-property-in-model-hook/8198>\
**Category:** Uncategorized\
**Created:** [June 16, 2015, 3:59pm UTC](https://discuss.emberjs.com/t/computed-property-in-model-hook/8198 "2015-06-16T15:59:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnny\_bushy](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@johnny\_bushy](https://discuss.emberjs.com/u/johnny_bushy)\
**Post date:** [June 16, 2015, 3:59pm UTC](https://discuss.emberjs.com/t/computed-property-in-model-hook/8198/1 "2015-06-16T15:59:35Z")

</div>

Hi, guys…

Suppose we have such a route, where

```
Ember.Route.extend({
    data: [],
    model: {
        return {
            filterData: Ember.computed.filter("data.[]", function(
                // just example
                return true;
            ))
        }
    }
    actions: {
        loadMoreData: function() {
            Ember.$.ajax.get("/api/data").then(function(response) {
                this.data.pushObjects(response.data);
            })
        }
    }
})

```

So, of course, that doesn’t work cause there is no field “data” in object, returning from model hook.  
But I was sure that proper pattern is to make all server requests from route. And that way, I can’t understand how I can provide it available in a template scope.

Any ideas? How do you organize code for routes with pagination and sorting on the page?

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [June 16, 2015, 8:36pm UTC](https://discuss.emberjs.com/t/computed-property-in-model-hook/8198/2 "2015-06-16T20:36:00Z")

</div>

My Sorting and Pagination example is perhaps interesting:

> <https://github.com/broerse/ember-cli-blog/blob/master/app/controllers/posts.js>
