4
I am creating in a system that I am developing for our client, a function where it allows the same to upload the logo and cut the same, then when it saves I am trying to load the image that was uploaded, but it turns out I always need to be the same name and in the same destination and the browser can’t update the same one, for example:
Current image name = logo.png;
after uploading the image name continues logo.png but with another image saved, because if you reload the page the logo is applied as it should, I wonder if you have any way to do this without reloading the page, follow the code that I use to set the image:
$scope.carregarLogo = function(name){
if($scope.img_name=== '' && angular.isUndefined(name) || name === ''){
$scope.img_name = url_sistema + 'web_files/img/logo.png';
$('#img').attr('src',$scope.img_name);
console.log('deu');
}else{
$scope.img_name = name;
$('#img').attr('src',$scope.img_name);
console.log($('#img').attr('src'));
console.log('deu2');
}
};
+1. I have had the same problem but I did not find the solution, so I added the problem using
$window.location.reload();
– DiegoAugusto
Techies, this does not solve the problem. It only creates a gambit and prevents you from understanding Angularjs in the right way.
– Juan Biscaia
@Juanbiscaia So I gave the +1 and as I commented I did not find the solution, and also said that "I agreed" the problem. I didn’t say it was the solution to the problem rs.
– DiegoAugusto