Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created February 22, 2021 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydemann/71b2c7362ff979840828295e4641704f to your computer and use it in GitHub Desktop.
Save lydemann/71b2c7362ff979840828295e4641704f to your computer and use it in GitHub Desktop.
course-content.component.ts
private getTrustedVideoUrl(url: string): SafeResourceUrl {
// Url domains are whitelisted using CSP header
// Content-Security-Policy: frame-src <source> <source>;
const sanitizedUrl = this.sanitizer.sanitize(
SecurityContext.RESOURCE_URL,
url
);
return this.sanitizer.bypassSecurityTrustResourceUrl(sanitizedUrl);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment