onInactive
onInactive
Called when the page becomes inactive. At this point the form's data is cleared (clearData).
Parameters: None
Returns: No return value — this is a callback, so its return value isn't used.
Description
Called when the user navigates to another page and leaves this one. It's the right moment for cleanup work before the screen goes away — unsubscribing, saving temporary state, and the like.
Example
function onInactive() {
$log.i("page inactive, data will be cleared");
$vm.unsubscribeData("liveTicker");
}
Related and cautions
warning
There is a similarly named onInactivate, but it too is an unfinished event that nothing actually calls. Always write code that reacts to leaving a page in onInactive.
- The form's data is cleared immediately after this event, so handle any value you need to preserve inside this function.