Is this.controllerFor still being used?

Or is it deprecated? I’m getting mixed answers via google. It seems like controller.set might be the most current best practice to tell an arraycontroller which model to represent?

If its still being used, what is the difference between this.controllerFor and controller.set?

It is still used in routes, but in controllers it is deprecated in favor of needs. Blog on needs > http://darthdeus.github.com/blog/2013/01/27/controllers-needs-explained/

1 Like

Is controllerFor deprecated inside the route as well? If so, what is the correct format?

1 Like

Still there: http://emberjs.com/api/classes/Ember.Route.html#method_controllerFor

I think the key point is:

The controller instance must already have been created, either through entering the associated route or using generateController.

Which gets some people. Typically, don’t “get” controllers if they are not a parent of the current route. If you are, you probably should look at putting state in a Service instead. http://guides.emberjs.com/v2.0.0/services/

1 Like