blob: 2ecdc0243dbe5833e11f3f55ab0f969722956a0a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core'
import { CustomMarkupService } from './custom-markup.service'
@Component({
selector: 'my-custom-markup-container',
templateUrl: './custom-markup-container.component.html',
styleUrls: [ './custom-markup-container.component.scss' ]
})
export class CustomMarkupContainerComponent implements OnChanges {
@ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement>
@Input() content: string
constructor (
private customMarkupService: CustomMarkupService
) { }
async ngOnChanges () {
await this.buildElement()
}
private async buildElement () {
const element = await this.customMarkupService.buildElement(this.content)
this.contentWrapper.nativeElement.appendChild(element)
}
}
|