为什么Proprety调用{{here.name}}在A< h>但不在A< img>
在模板中,以下代码正常工作:
<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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试一下
Try this
在这种情况下,请使用模板字符串:
/pictures/$ {here.name} | getDownloadurl
Use template strings in such cases:
/pictures/${hero.name} | getDownloadURL
尝试使用``quotes
''/pictures/ {hero.name}} | getDownloadurl“
try to use `` quotes
"`/pictures/{{hero.name}} | getDownloadURL"