mirror of https://github.com/abpframework/abp.git
4 changed files with 21 additions and 2 deletions
@ -0,0 +1,13 @@ |
|||
import { inject, Injectable, Pipe, PipeTransform, SecurityContext } from '@angular/core'; |
|||
import { DomSanitizer } from '@angular/platform-browser'; |
|||
|
|||
@Injectable() |
|||
@Pipe({ name: 'abpSafeHtml' }) |
|||
export class SafeHtmlPipe implements PipeTransform { |
|||
private readonly sanitizer = inject(DomSanitizer); |
|||
|
|||
transform(value: string): string { |
|||
if (typeof value !== 'string') return ''; |
|||
return this.sanitizer.sanitize(SecurityContext.HTML, value); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue