我試圖將我的資料庫中的圖片匯入到 SVG 中的影像中,我曾經使用過<img>并且顯示圖片沒有問題,但是當我嘗試在 SVG 中顯示它時,我收到此錯誤:
Cannot GET /SafeValue must use [property]=binding: http://localhost/doc/image.jpg (see https://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);
我似乎找不到任何解決方案,也不知道是什么導致了問題
uj5u.com熱心網友回復:
嘗試將 [attr.xlink:href] 更改為 [src]
uj5u.com熱心網友回復:
問題出在這個
this.url = this.sanitizer.bypassSecurityTrustResourceUrl(objectURL);
我剛剛洗掉它,它作業得很好
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/390678.html
上一篇:如何在CRUD方法中重用可觀察值
下一篇:物件陣列按另一個陣列值過濾
