Reputation: 1098
The Angular documentation recommends using "NgOptimizedImage" to load images. I followed the instructions but there does not seem to be an NgOptimizedImage export anywhere. When I add the following statement, I get an error. I'm assuming that perhaps NgOptimizedImage is not that useful and has been deprecated, and the docs simply haven't been updated.
import { NgOptimizedImage } from '@angular/common';
Module '"@angular/common"' has no exported member 'NgOptimizedImage'.
This all comes directly from the official Angular page: https://angular.io/api/common/NgOptimizedImage
Upvotes: 1
Views: 998
Reputation: 298
I just tried to use the NgOptimizedImage directive in a stackblitz and seems to be working just fine.
Are you importing the directive in the module and not your component?
NgOptimizedImage was only added in Angular 14.2 so maybe that's your problem?
Stackblitz example
Upvotes: 6