I have a long loop for, when I ty to turn on annother controller from the the browser on clicking on annother link, the first process continue executing and I can't access to the second controller, is there any solution, I try this code but it dosen't give the result
$scope.exit = false
$scope.$on("$destroy", function(){
$scope.exit = true
});
for (var x = 0; x < myArray.length; x++) {
if($scope.exit)
break;
//my code
}