I have a problem with Angular's ng-repeat directive, I'm creating a banner component that works as follows: when you click on add image, that image is converted to base64 and the new image is added to an array and it is with this array that the path of the ng-repeat is made, the code that I have is the following:
<div class="img" ng-repeat="imagen in imagenes track by $index">
<div class="cont_img">
<img src="{{ imagen.imagen }}" alt="" class="img-responsive imagen">
</div>
</div>
and on the Controller:
$scope.imagenes = [];
$scope.cambioUpload = function($file){
var reader = new FileReader();
reader.readAsDataURL($file.value[0]);
var dataURL = '';
reader.onload = function(){
dataURL = reader.result;
$scope.imagenes.push({
temporal : $scope.imagenes.length + 1,
imagen: dataURL,
tiempo: 0
});
}
}
The problem is that the new image that was added is not updated in real time, it appears only when clicking anywhere on the page, I do not know why this is happening.