2022-09-15 17:01:50 +10:00

24 lines
526 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 = '';
// eslint-disable-next-line no-useless-constructor
constructor(private sanitizer: DomSanitizer) {}
get safeContent() {
return this.sanitizer.bypassSecurityTrustHtml(this.content);
}
}