# ArrayController's property for each item in the model in ember

**URL:** https://discuss.emberjs.com/t/arraycontrollers-property-for-each-item-in-the-model-in-ember/7610
**Category:** Uncategorized
**Created:** [March 24, 2015, 9:02am UTC](https://discuss.emberjs.com/t/arraycontrollers-property-for-each-item-in-the-model-in-ember/7610 "2015-03-24T09:02:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![baji\_mprasanna](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@baji\_mprasanna](https://discuss.emberjs.com/u/baji_mprasanna)
#### Post date: [March 24, 2015, 9:02am UTC](https://discuss.emberjs.com/t/arraycontrollers-property-for-each-item-in-the-model-in-ember/7610/1 "2015-03-24T09:02:57Z")

</div>

I posted this question in stackoverflow but didn’t get any answer. So I’m posting here.

I’ve an Array controller which has the property “isChecked” (boolean property). In my controller I want to get the collection of elements which are “checked” (I mean selected). I’m not sure how to access the controller’s property in the model.

My controller is as follows:

```
App.ExampleController = Ember.ArrayController.extend({
    isChecked: false,
    totalElements: function()
    {
        return this.model.get('length');
    }.property('@each'),
    selectedElements: function()
    {
        var content = this.get('content');
        console.log(content.filterBy('isChecked'));
        return content.filterBy('isChecked');
    }.property('isChecked'), });

```

I linked the “isChecked” property to a checkbox inside each helper as follows…

```
<ul>
   {{#each model}}
        <li>
            {{input type="checkbox" checked=isChecked}}
            {{name}}
        </li>
    {{/each}}
</ul>

```

I will display all the items in the model with a checkbox associated with it. The user can select few items from it. So I want those items.

Now I want to get the list of elements which are “checked”. Either as a computed property or under any action.

---

<div class="post-metadata">

### Author: ![robdel12](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/robdel12/32/9337_2.png) [@robdel12](https://discuss.emberjs.com/u/robdel12)
#### Post date: [March 24, 2015, 3:32pm UTC](https://discuss.emberjs.com/t/arraycontrollers-property-for-each-item-in-the-model-in-ember/7610/2 "2015-03-24T15:32:36Z")

</div>

Have you looked at the [ember getting started](http://emberjs.com/guides/getting-started/displaying-the-number-of-incomplete-todos/) guides? I think this is exactly what you want 😄

Couple things to note:

- `Ember.ArrayController` is going away in the future. It’s safer to use `Ember.Controller.extend` instead

- The context switching form of `{{each}}` is deprecated. Use `{{#each checkbox in model}}` instead.

---

<div class="post-metadata">

### Author: ![baji\_mprasanna](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@baji\_mprasanna](https://discuss.emberjs.com/u/baji_mprasanna)
#### Post date: [March 25, 2015, 7:53am UTC](https://discuss.emberjs.com/t/arraycontrollers-property-for-each-item-in-the-model-in-ember/7610/3 "2015-03-25T07:53:45Z")

</div>

I actually worked it completely. The difference between the todo app and mine is that it uses store. Whereas in my app I don’t. I directly return the response from the web service to the model.
