August 2017
Beginner to intermediate
370 pages
8h 37m
English
Instead of using individual APIs for bypassing Angular built-in sanitization, one could create a reusable custom pipe such as the following, save it in file such as app/pipes/security-bypass.pipe.ts, import the pipe in root module such as AppModule, and, use them in one or more components across different modules.
import {Pipe, PipeTransform} from '@angular/core';import {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from "@angular/platform-browser";@Pipe({ name: 'trusted'})export class SecurityBypass implements PipeTransform { constructor(private sanitizer: DomSanitizer) {} public transform(value: string, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl ...
Read now
Unlock full access