Add loading="lazy" to the <img> tag, or use Ionic's <ion-img>, which loads the image only when it scrolls into view.
<!-- Native browser lazy loading -->
<img src="assets/photo.jpg" loading="lazy" width="320" height="240" alt="Photo" />
<!-- Ionic component: loads when it enters the viewport -->
<ion-img src="assets/photo.jpg" alt="Photo"></ion-img>
<!-- Angular's optimized image directive: lazy by default, set priority for the hero image -->
<img ngSrc="assets/photo.jpg" width="320" height="240" alt="Photo" />- Always set
widthandheight(or use CSS aspect-ratio) so the layout does not jump when the image appears. - Do not lazy load images that are visible on first paint; it delays them.
- Inside
ion-contentlists,ion-imgworks well because it observes the scrolling container. - For custom behavior, an IntersectionObserver in a small directive can set
srcwhen the element becomes visible.
