Ontica/Empiria.Land.Intranet

View on GitHub
src/app/shared/pipes/safe-html.pipe.ts

Summary

Maintainability
A
0 mins
Test Coverage

/**
 * @license
 * Copyright (c) La Vía Óntica SC, Ontica LLC and contributors. All rights reserved.
 *
 * See LICENSE.txt in the project root for complete license information.
 */

import { Pipe, PipeTransform } from '@angular/core';

import { DomSanitizer } from '@angular/platform-browser';


@Pipe({
  name: 'safeHtml'
})
export class SafeHtmlPipe implements PipeTransform {

  constructor(private sanitized: DomSanitizer) { }

  transform(value) {
    if (value) {
      return this.sanitized.bypassSecurityTrustHtml(value);
    } else {
      return '';
    }
  }

}