Ho questo codice le righe:Come fermare lodash.js _.each loop?
_.each($scope.inspectionReviews, function (value, key) {
alert("status=" + value.IsNormal + " " + "name=" + value.InspectionItemName);
if (!value.IsNormal) {
$scope.status = false;
return;
}
$scope.status = true;
})
Ad un certo punto che voglio smettere di looping, ma sembra che il ritorno non funziona.
Come posso interrompere il ciclo?
Hai provato a restituire false? – adeneo
Prova a ['break'] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break) it –
Possibile duplicato di [Come interrompere un ciclo for?] (http://stackoverflow.com/questions/9830650/how-to-stop-a-for-loop) – Jesse