anyone know how i solve it? I added an element to my array with the push function and then tried to access the array at position 3 that was added to the element but not as defined
readThis(inputValue: any): void {
this.contImage = inputValue.files.length;
for (var i = 0; i < inputValue.files.length; i++) {
let file: File = inputValue.files[i];
let myReader: FileReader = new FileReader();
myReader.onloadend = (e) => {
if(file.size <= 4000000){
this.imageValues.push(myReader.result);
}else{
swal(
'Ops! Imagem muito grande',
'Algumas imagens não puderam ser enviados pois excede o tamanho maximo de 5 Megas :/',
'error'
);
}
}
myReader.readAsDataURL(file);
}
this.editeImage();
}
editeImage(){
console.log(this.imageValues[3]);
}