为什么Proprety调用{{here.name}}在A< h>但不在A< img>

发布于 2025-01-28 20:48:08 字数 533 浏览 4 评论 0原文

在模板中,以下代码正常工作:

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

或偶数:

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

但是,当涉及以下图像路径:

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

将其解释为字符串,如错误消息中:

错误firebaseError:firebase存储:object'pictures/{ober.name}}' 不存在。 (储存/对象 - 诺)

即使可以通过以下方式访问图片:

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

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:

<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" />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

晨敛清荷 2025-02-04 20:48:08

尝试一下

&lt; img [src] =“'/pictures/' + hero.name | getDownloadurl”/&gt;

Try this

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

不及他 2025-02-04 20:48:08

在这种情况下,请使用模板字符串:
/pictures/$ {here.name} | getDownloadurl

Use template strings in such cases:
/pictures/${hero.name} | getDownloadURL

如何视而不见 2025-02-04 20:48:08

尝试使用``quotes

''/pictures/ {hero.name}} | getDownloadurl“

try to use `` quotes

"`/pictures/{{hero.name}} | getDownloadURL"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文