1 import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core'
2 import { CustomMarkupService } from './custom-markup.service'
5 selector: 'my-custom-markup-container',
6 templateUrl: './custom-markup-container.component.html'
8 export class CustomMarkupContainerComponent implements OnChanges {
9 @ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement>
11 @Input() content: string
14 private customMarkupService: CustomMarkupService
17 async ngOnChanges () {
18 await this.buildElement()
21 private async buildElement () {
22 const element = await this.customMarkupService.buildElement(this.content)
23 this.contentWrapper.nativeElement.appendChild(element)