How to stop a running script move to new page in ionic3

I have a loop running in my .ts file …i want on a certain condition the loop should stop and new page should appear breaking the loop …but I am not able to achieve that. i am able to go to the new page but script from previous page is stilling running which is creating problem

Hello,

without any code it is hard to say what happens or could used for better understanding. A simple

break;

before you go to the new page isn’t a solution?

Best regards, anna-liebt