Hello, I have a code in angularJS but it only works when I am in the browser debug.
$scope.upload=function(){
var newFiles = [];
$scope.carregando = true;
angular.forEach($scope.files, function (item) {
if(item.upload){
item.idFicha = vm.ficha.id;
var reader = new FileReader();
reader.readAsDataURL(item._file);
//TODO Quero recuperar a substring do result.
item.arquivo = reader.result.substr(reader.result.indexOf(',') + 1);
newFiles.push(item);
item.upload = false;
}
});
service.uploadDocumento(newFiles);
$scope.carregando = false;
};
Well, when I take the breakpoint to perform the function the variable item.file is null, but if I put the breakpoint and inspect the variable is is with value and the function works perfectly.
What may be happening and what should I do to end this problem?