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?
Hi,
Try to add cache: false in the state of this view:
.state(‘app.countdown’, {
cache: false,
url: “/countdown”
}
@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.
Set cache to false did not work.