Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember.js: controllerFor x needs

Tags:

ember.js

I'm having a problem with controllerFor, and I found this pull request which describes deprecating controllerFor:

https://github.com/emberjs/ember.js/pull/1896

So this means that I can't use controllerFor? And if the answer is "not", why does the Ember.js docs still talk about using controllerFor, as seen here:

http://emberjs.com/guides/routing/setting-up-a-controller/

like image 216
user1257120 Avatar asked Mar 20 '13 01:03

user1257120


1 Answers

The pull request you linked to deprecates the controllerFor method in Ember.Controller. You can and should use controllerFor within the router, which is how it is used in the guide you referenced.

Instead of using controllerFor from controllers you are supposed to instead use the needs mechanism, which is discussed in this guide.

like image 161
CraigTeegarden Avatar answered Sep 27 '22 03:09

CraigTeegarden