import { Pipe, PipeTransform, Inject } from '@angular/core'; import { DOCUMENT } from '@angular/common'; @Pipe({ name: 'entity2text' }) export class Entity2textPipe implements PipeTransform { constructor(@Inject(DOCUMENT) private document: any) {} transform(htmlEntityText: string, args?: any): any { const tempElement = this.document.createElement('span'); tempElement.innerHTML = htmlEntityText; return tempElement.textContent || tempElement.innerText; } }