mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
1ca2ce19ab
Previously NgOptimizedImage would default to requesting an image at the width matching the width attribute in the image HTML. While this works for width attrs that match the intrinsic size of the image (e.g. responsive images or images sized with CSS), this can be a sharp edge for developers who use the width/height attributes to set rendered size (i.e. instead of CSS, which one can do for a fixed size image). In this case, defaulting to the width attribute for the requested image would mean requesting always at 1x quality, so screens with a DPR of 2+ get an image that is too small. Without a default request width, the image served by the CDN would likely be at intrinsic size, so 2x images would look correct. This PR also updates the NgOptimizedImage sandbox and tests. PR Close #47082
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT