Skip to content

Angular tips

Matěj Chalk edited this page Jul 28, 2020 · 1 revision

Angularfeatures/bugs/hacks

  • Add thinks which are not violating our company rules or it's consulted with others

Scrolled iframe reloads after scrolling outside of iframe

  • It's caused by DomSanitizer you can't use it in component function to sanitize ResourceURL 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);
  }
}
Clone this wiki locally