I tried using break Statement. but didnt worked out. I wanted to break out from outer loop as soon as some condition matches in inner loop.
angular.forEach(myfilejob, function(fieldMapO) {
var count = 0;
angular.forEach(myfilejob, function(fieldMapI) {
if(fieldMapO.key == fieldMapI.key){
$scope.dupKey = fieldMapI.key;
count ++;
}
});
if(count>1){
$scope.dups = true;
// tried break , but didnt work
}
else{
$scope.dups = false;
}
});
forEachcalls with a function require you toreturn false(or some other value) to tell the iterator to exit. I can't imagine angular performs any differently.angular.forEachdoesn't supportbreak;statement, to get it support you need to fallback on older version simple for loop.if/elsein your inner loop? (Not that this would solve your problem outright)