@Component({
selector: 'my-custom-markup-container',
- templateUrl: './custom-markup-container.component.html',
- styleUrls: [ './custom-markup-container.component.scss' ]
+ templateUrl: './custom-markup-container.component.html'
})
export class CustomMarkupContainerComponent implements OnChanges {
@ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement>
@Input() content: string
+ displayed = false
+
constructor (
private customMarkupService: CustomMarkupService
) { }
}
private async buildElement () {
- const element = await this.customMarkupService.buildElement(this.content)
- this.contentWrapper.nativeElement.appendChild(element)
- }
+ if (!this.content) return
+
+ const { rootElement, componentsLoaded } = await this.customMarkupService.buildElement(this.content)
+ this.contentWrapper.nativeElement.appendChild(rootElement)
+ await componentsLoaded
+
+ this.displayed = true
+ }
}