📜  角度转义样式 attr - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:08.988000             🧑  作者: Mango

代码示例1
import { DomSanitizer } from '@angular/platform-browser'
import { PipeTransform, Pipe } from "@angular/core";

@Pipe({ name: 'safeHtml'})
export class SafeHtmlPipe implements PipeTransform  {
  constructor(private sanitized: DomSanitizer) {}
  transform(value) {
    return this.sanitized.bypassSecurityTrustHtml(value);
  }
}