0
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 execute the variable function item.file is null, but if I put the breakpoint and inspect the variable is with value and the function works perfectly.
What can be happening and what I must do to end this problem?