Template is not rerendering loop about changed controller variable


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 …


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


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


    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.


I have to use this code:

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

This told me the Ember.JS guide here: http://guides.emberjs.com/v2.0.0/templates/displaying-a-list-of-items/