How can canceled settimeout and cleartime when i changed page?


#1

Hi, i am using settimeout at my app and that is working. but settimeout still in progress
when i changed page. How can canceled?


#2

Hey, ı found solution !
ionViewCanLeave() { clearTimeout(this.timer); console.log("Should I leave? Yes"); return true; }
This function shows you leave the page at the ionic2 and If it turns true, that is allows you to leave the page. And runing clearTime function when i leaved page.

Have good day ! :wink: