Issue
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 class="container" *ngIf="!loading">
<h3 class="title mb-3" >VĂdeos</h3>
<div class="row">
<div class="col-sm-3 py-3" *ngFor=" let video of item.config.videos">
{{video}}<!-- https://www.youtube.com/embed/-fclle4fEuU-->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="{{video | safe}}" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
the safe pipe
transform(url) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
Solution
With DomSanitizer you should use it like this:
[src]="video | safe"
Answered By - Ardit
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.