What is NgOptimizedImage and what does it give you?
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
- Why is track important in @for (or trackBy in *ngFor)?
- What are the main ways to improve Angular app performance?
- Why is calling a method in a template expression a performance problem?
- What is server-side rendering (SSR), and why would you use it?
- What is hydration in Angular?
- What is the difference between SSR, SSG (prerendering) and CSR, and how do you choose?