【发布时间】:2022-01-23 06:47:44
【问题描述】:
我正在尝试将图片从我的数据库导入到 SVG 中的图像中,我曾经使用 <img> 并且显示图片时没有问题,但是当我尝试在 SVG 中显示它时出现此错误:
Cannot GET /SafeValue%20must%20use%20[property]=binding:%20http://localhost/doc/image.jpg%20(see%20https://g.co/ng/security
这是我的代码,AVG太大了,所以我只是放了图像部分:
HTML
<svg class="animated" " version="1.1" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" >
<image [attr.xlink:href]="url" height="139.85" width="111.45" x="122.19" y="87.55"/>
</svg>
ts
let objectURL = this.dataService.Url + '/doc/' + Candidat.photo;
this.url = this.sanitizer.bypassSecurityTrustResourceUrl(objectURL);
我似乎找不到任何解决方案,也不知道是什么导致了问题
【问题讨论】:
标签: angular svg sanitization