<p>{{ lesson?.description | replaceHtmlTags }}</p>
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'replaceHtmlTags' })
export class ReplaceHtmlTagsPipe implements PipeTransform {
transform(html: string): string {
return html.replace(/<\/?[^>]+(>|$)/g, '');
}
}
@NgModule({
declarations: [ReplaceHtmlTagsPipe],
// ...
})
export class AppModule { }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter