无法绑定到':xlink:href',因为它不是':svg:image'的已知属性 [英] Can't bind to ':xlink:href' since it isn't a known property of ':svg:image'

查看:636
本文介绍了无法绑定到':xlink:href',因为它不是':svg:image'的已知属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试像这样动态设置svg图像的href:

I am trying to set dynamicly href for svg image like this :

<svg style="width:100%; height:100%">
    <image x="-29" y="7" height="53" width="170" xlink:href="{{logoFile}}"  />
</svg>

但是随后在控制台中出现错误: 无法绑定到':xlink:href',因为它不是':svg:image

but then I got error in console : Can't bind to ':xlink:href' since it isn't a known property of ':svg:image

推荐答案

由于xlink:href是SVG的属性,而不是SVG 属性绑定:

Since xlink:href is an attribute but not a property of the SVG image element, use attribute binding:

[attr.xlink:href]="logoFile"

有关演示,请参见此stackblitz .

这篇关于无法绑定到':xlink:href',因为它不是':svg:image'的已知属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆