-
Notifications
You must be signed in to change notification settings - Fork 0
Angular tips
Matěj Chalk edited this page Jul 28, 2020
·
1 revision
- Add thinks which are not violating our company rules or it's consulted with others
- It's caused by
DomSanitizer
you can't use it in component function to sanitizeResourceURL
instead of this use pipe, something like this:
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
@Pipe({ name: 'safeResourceUrl' })
export class SafeResourceUrlPipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
transform(url: string): SafeResourceUrl {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
}