ngImgCrop: result-image not working

Is it from some reason possible please that when I move working code inside angular ui-bootstrap. The result image is not updating anymore on crop?

The code:

<img-crop image="myImage" area-type="square" result-image="myCroppedImage"></img-crop>

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 23 (2 by maintainers)

Most upvoted comments

Actually what solved it for me was making sure image and result-image were not set directly on the $scope object.

So instead of:

$scope.image = '';
$scope.croppedImage = '';

I used:

$scope.image = {
   originalImage: '',
   croppedImage: ''
};

Then updated my directive to:

<img-crop
   image="image.originalImage"
   result-image="image.croppedImage"></img-crop>

And that seemed to resolve the problem. I think it is something to do with the way angular treats string values assigned to $scope by value rather than by reference.