Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 13x 13x 2x | import { Pipe, PipeTransform } from '@angular/core';
/**
* The HTML encode pipe simply replaces HTML special characters like angle brackets (< and >) with HTML entities
* so they can be displayed as plain text in a web page.
* https://jasonwatmore.com/vanilla-js-html-encode-in-javascript
*/
@Pipe({ name: 'ishHtmlEncode', pure: true })
export class HtmlEncodePipe implements PipeTransform {
transform(value: string): string {
return value?.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
}
}
|