Skip to content

disableOptimizedSrcset from NgOptimizedImage is not working with [srcset] attribute binding #49335

@georgelviv

Description

@georgelviv

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

No

Description

We just added new feature to our project NgOptimizedImage. But as we are using firebase storage for images, our links are hashed, so there are no way to construct link with ImageLoaderConfig.

disableOptimizedSrcset is not working with srcset attribute binding.

Example below is not working. srcset is empty and not present in HTML
<img width=100 disableOptimizedSrcset height=100 [ngSrc]="imageUrl" [srcset]="image2Url + ' 2x'"/>

As workaround, we use [attr.srcset] and it works as expected
<img width=100 height=100 [ngSrc]="imageUrl" [attr.srcset]="image2Url + ' 2x'"/>
It works fine if no attribute binding is present

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-zssdn7?file=src/main.ts

Please provide the exception or error you saw

No errors

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.0.4
Node: 16.16.0
Package Manager: npm 8.11.0
OS: darwin arm64

Angular: 15.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.4
@angular-devkit/build-angular   15.0.4
@angular-devkit/core            15.0.0
@angular-devkit/schematics      14.2.9
@angular/cdk                    15.0.3
@angular/fire                   7.5.0
@angular/google-maps            15.0.3
@schematics/angular             14.1.2
rxjs                            7.5.5
typescript                      4.8.4

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions