# Template is not rerendering loop about changed controller variable

**URL:** <https://discuss.emberjs.com/t/template-is-not-rerendering-loop-about-changed-controller-variable/8790>\
**Category:** Uncategorized\
**Created:** [September 16, 2015, 2:46pm UTC](https://discuss.emberjs.com/t/template-is-not-rerendering-loop-about-changed-controller-variable/8790 "2015-09-16T14:46:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![volontarian](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/volontarian/32/11252_2.png) [@volontarian](https://discuss.emberjs.com/u/volontarian)\
**Post date:** [September 16, 2015, 2:46pm UTC](https://discuss.emberjs.com/t/template-is-not-rerendering-loop-about-changed-controller-variable/8790/1 "2015-09-16T14:46:30Z")

</div>

Given 2 array items when I add new input then I want to see 3 array items but still only see 2 array items.

This is my current code …

**Route**

```
    model: (params) ->
      @controllerFor('pages').set 'myArray', []

```

**Template**

```
  <ul>
  {{#each myArray as |item itemIndex|}}
    <li>{{item}}</li>
  {{/each}}
</ul>
<input id="my_input"/><button {{action 'addInput'}}/>

```

**Controller**

```
    addInput: ->
      array = @get('myArray')
      array.push $('#my_input').val()
      @set 'myArray', array

```

How can I get the template to rerender / auto-update the loop about changed controller variable “myArray”?

I’m using Ember 1.13.8.

---

<div class="post-metadata">

**Author:** ![volontarian](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/volontarian/32/11252_2.png) [@volontarian](https://discuss.emberjs.com/u/volontarian)\
**Post date:** [September 16, 2015, 4:09pm UTC](https://discuss.emberjs.com/t/template-is-not-rerendering-loop-about-changed-controller-variable/8790/2 "2015-09-16T16:09:35Z")

</div>

I have to use this code:

```
array.pushObject $('#my_input').val()

```

This told me the Ember.JS guide here: [Displaying a List of Items - Templates - Ember Guides](http://guides.emberjs.com/v2.0.0/templates/displaying-a-list-of-items/)
