Forcing a ng-src reload

前端 未结 5 796
生来不讨喜
生来不讨喜 2020-12-07 21:59

How can I force angularjs to reload an image with an ng-src attribute, when the url of the image has not changed, but its contents has?

5条回答
  •  有刺的猬
    2020-12-07 22:32

    Try This

    app.controller('ctrl', ['$scope', 'R4aFact', function($scope, R4aFact){
    $scope.clickReplace = function() {
        R4aFact.uploadReplace($scope.imgfile, $scope.pid).then(function(response){
            $scope.urlprofilephoto  = response + "?" + new Date().getTime(); //here response is ur image name with path.
        });
    }
     }])
    

提交回复
热议问题