How to replace Ember.ArrayController


#1

What is the correct way to achieve this without Ember.ArrayController?

http://ember-twiddle.com/cbd9bf9bd20ca12f0f76

I know i can use normal js array and triger rerender manual or use Ember.Controller plus mixins to recreate Ember.ArrayController.

But all of them feels hacky,


#2

Seems like i could use Ember.A().

http://ember-twiddle.com/3392df77084824f64396

The only problem is, although it has been there for a very long time, i can’t find it any where in the guides. Should i use it?


#3

If you return an array from the route’s model hook, Ember is smart enough to set things up properly. You’ll be able to access the array within your controller with a simple this.model and within your template with model. Using Ember.A() is also a perfectly sound approach. You can read about it here.


#4

Problem with return a array from model hook is i can’t find a proper way to update display after modify it. The only way i find to make it work is call rerender in the component manually.


#5

@xudaiqing http://ember-twiddle.com/d5b54c466c482a772b50


#6

So native array already extend to have what Ember.A() give.

seems like i just missed http://guides.emberjs.com/v1.13.0/configuring-ember/disabling-prototype-extensions/