0
votes

I was going through the Ember tutorial in https://guides.emberjs.com/v3.0.0/routing/preventing-and-retrying-transitions/#toc_storing-and-retrying-a-transition

Here, in order to store and retry a transition, they're setting an instance property previousTransition in loginController.

How does controllerFor work? Will loginController not be instantiated again when routed to the corresponding route?

How is previousTransition persisted so that they're accessing it in loginController?

I'm new to Ember. Could someone throw some light on this?

1

1 Answers

0
votes

Controllers are singletons in ember.js. A Controller is not instantiated again if a route is reentered. The same applies for Routes. Route provides events, which could be used to reset state on entering / leaving the route.