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',
7 styleUrls: [ './custom-markup-container.component.scss' ]
9 export class CustomMarkupContainerComponent implements OnChanges {
10 @ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement>
12 @Input() content: string
15 private customMarkupService: CustomMarkupService
18 async ngOnChanges () {
19 await this.buildElement()
22 private async buildElement () {
23 const element = await this.customMarkupService.buildElement(this.content)
24 this.contentWrapper.nativeElement.appendChild(element)