I'm trying to put a youtube video on to show on my html page but I have this error Error: unsafe value used in a resource URL context
in my code everything seems to be ok, I'm using pipe safe
<div *ngIf="!loading">
<h3 >Vídeos</h3>
<div >
<div *ngFor=" let video of item.config.videos">
{{video}}<!-- https://www.youtube.com/embed/-fclle4fEuU-->
<div >
<iframe src="{{video | safe}}" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
the safe pipe
transform(url) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
CodePudding user response:
With DomSanitizer you should use it like this:
[src]="video | safe"