0

This is essentially my HTML. It is part of a responsive design so I cannot rely on fixed widths/heights:

<img ng-src="{{imageSrc}}" />

The value of $scope.imageSrc is changed inside my controller and the view is updating properly.

But: At the point of time the image has finished rendering I need to get its clientWidth and clientHeight properties.

So how can I detect programmatically that

  1. the image has finished loading and
  2. the view has been fully updated with the rendered image

without using weird timeouts?

devnull69
  • 16,402
  • 8
  • 50
  • 61

1 Answers1

2

Two other questions will help you here. This SO post will detect loading via the load event.
And this post will detect rendering via requestAnimationFrame.

Community
  • 1
  • 1
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406