What is NgOptimizedImage and what does it give you?

Angular performance and SSR · Freshers and experienced

Model answer

NgOptimizedImage is a directive (ngSrc) that applies image best practices: it warns when width and height are missing, which prevents layout shift, lazy loads images by default, supports a priority attribute for the main image (LCP), generates srcset for responsive sizes when you use an image loader, and checks that priority images have a preconnect hint.

It helps Core Web Vitals scores. Use priority only for the one or two images visible at the top of the page.

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions