Home > Enterprise >  I can't show image imported from database inside SVG
I can't show image imported from database inside SVG

Time:12-22

I am trying to import a picture from my database into an image in an SVG, I used to work with <img> and I had no problem showing the picture but when I tried to show it inside an SVG I got this error :

Cannot GET /SafeValue must use [property]=binding: http://localhost/doc/image.jpg (see https://g.co/ng/security

and this is my code, the AVG is so big, so I just putted the image part:

HTML

  <svg  " 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);

I can't seem to find any solution and to know what is causing the problem

CodePudding user response:

Try changing [attr.xlink:href] with [src]

CodePudding user response:

The problem was in this

 this.url = this.sanitizer.bypassSecurityTrustResourceUrl(objectURL);

I just removed it and it worked just fine

  • Related