Feat: created pipe only for strip html; Feat: created example project;

This commit is contained in:
Lorenzo Iovino 2019-05-08 11:21:51 +02:00
parent 30284843fb
commit fd2734d0da
47 changed files with 22064 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import {
Pipe, PipeTransform
} from '@angular/core';
@Pipe({ name: 'stripper' })
export class NgxStripperPipe implements PipeTransform {
transform(inputString: string, type: 'html') {
if(type === 'html' || !type) {
const htmlEl = document.createElement("div");
htmlEl.innerHTML = inputString;
return htmlEl.textContent || htmlEl.innerText || "";
}
}
}