Are views still alive in backgroud?


#1

I have a countdown timer in a view that shows an alert when it ends.
The problem is that the alert will pop up even if I change views or go back.
It seems the view is still working in background
Is there anyway I can kill the view when I leave it or something similar?


#2

Hi,
Try to add cache: false in the state of this view:

.state(‘app.countdown’, {
cache: false,
url: “/countdown”
}


#3

@olebrun is correct but you could also keep caching enabled and listen to the $ionicView.afterLeave event in the controller and stop the countdown when that fires.


#4

Set cache to false did not work.