Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why does a proprety call {{hero.name}} work in a <h> but not in a <img>

In the template, the following code works normally:

<h3>{{hero.name}}</h3>

or even:

<a routerLink="/details/{{hero.id}}">{{hero.name}}</a>

But when it comes to the following image path:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<img [src]="'/pictures/{{hero.name}}' | getDownloadURL" />

It is interpreted as a string, as in the error message:

ERROR FirebaseError: Firebase Storage: Object ‘pictures/{{hero.name}}’
does not exist. (storage/object-not-found)

Even though the picture is accessible through:

<img [src]="'/pictures/mario' | getDownloadURL" />

>Solution :

Try this

<img [src]="’/pictures/’ + hero.name | getDownloadURL" />

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading