Wagm
Wagm

Reputation: 368

Angular2 iframe video " unsafe value used in a resource URL"

I am trying to use iframe vimeo video in my website, but I keep getting:

unsafe value used in a resource URL context (see http://g.co/ng/security#xss)

I know this question been asked before by people and I looked in the official documentation and using DomSanitizer, but I still get an error.

I have created simple stackblitz to illustrate the problem.

Upvotes: -1

Views: 375

Answers (1)

DrNio
DrNio

Reputation: 1976

change your iframe src to [src]="url"

and your constructor to

this.url = this.sanitizer.bypassSecurityTrustResourceUrl("https://player.vimeo.com/video/276885072");
  }

Upvotes: 1

Related Questions