Initialization Controller Status in EmberJs: Route # setupController vs Controller # init

There seem to be two alternative ways to set the initial state of the controller in EmberJs:

When is it advisable to use one over the other? Are they equivalent?

+3
source share
1 answer

Generally speaking, it Controller#initis called only once when a (usually single) controller is created, and it Route#setupControlleris called every time a route is entered.

Any properties associated with the model must be set from Route#setupController. Other default settings can be processed in Controller#init.

Ember, , Route#setupController , Controller#init.

+8

All Articles