Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created February 23, 2021 17:12
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/dae9f656ba0d64e184cc43d9ddda4fcf to your computer and use it in GitHub Desktop.
Save lydemann/dae9f656ba0d64e184cc43d9ddda4fcf 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.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