At what point does a Lightning component get destroyed ? More specifically we have been modelling "page" to "page" navigation using navigateToComponent events but it appears that old components we have navigated away from are still receiving events. Is there a more appropriate event or approach ?

Also, are there any events which inform a component that it is about to be destroyed ? I know the components renderer has an unrender method which is called when the component gets destroyed but is there anyway to detect component destruction without proving a custom renderer ?

We're looking for ways that we might clean up other JS resources associated with components.

cheers Dave

  • 1
    Our observation about old components still receiving events was incorrect. Using the unrender method we were able to see that our components were being destroyed. The echoes we were seeing related to config handlers attached to an angular module associated with an aurang:region.
    – user4116
    Dec 3, 2014 at 15:07

1 Answer 1


Issue is specific to config callbacks with Angular and aura-ng and is not a general lifetime or lifecycle issue in Lightning. Dave and I are working together on getting a fix for this into aurang:region for anyone else using aura-ng

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .