2022-09-15 16:05:35 +10:00

25 lines
508 B
TypeScript

import { Component, Input } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'storybook-html',
template: `<div [innerHTML]="safeContent"></div>`,
})
export default class HtmlComponent {
/**
* The HTML to render
*
* @required
*/
@Input()
content = '';
constructor(private sanitizer: DomSanitizer) {
this.sanitizer = sanitizer;
}
get safeContent() {
return this.sanitizer.bypassSecurityTrustHtml(this.content);
}
}