Temporary image while load image


I’m loading normally my images with ng-src but some places the cellular network doesn’t work pretty good, for that i need put some image before or while the image from data source is loading.


Put your image in a div or span and add a fixed background image for that container.
The loaded image should overlay the background image if it is loaded.

You could also add a directive to the container and listen to the ‘onload’ event of the containing image.
It would be done like this:

  1. container around your image
  2. add default backgroundimage via class
  3. add directive that listens on image ‘onloaded’
  4. if onloaded remove class from container


For now the div on background works perfectly, later i go to implement on a directive.