Img or background-image ? (which is faster?)


#1

Hello,
i have a huge collection-repeat list and for the sake of performance im trying to choose between using the img tag or the ng-style background-image attribute.
Any ideas which method is faster in terms of DOM load and performance?


#2

Hi,
Images are cached the same whatever technique you are using. I my opinion you will not notice any performance differences.


#3

If you’re using sources from a repeated list make sure you use ng-src

<img ng-src="" />

Personally I would go with background image because it’s easier to edit them using css.
Things like; center, cover, contain, position.