aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+home/home.component.ts
blob: 16d3a6df7cc6a405650d48de40098fbbad662498 (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
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
import { CustomMarkupService } from '@app/shared/shared-custom-markup'
import { CustomPageService } from '@app/shared/shared-main/custom-page'

@Component({
  templateUrl: './home.component.html',
  styleUrls: [ './home.component.scss' ]
})

export class HomeComponent implements OnInit {
  @ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement>

  constructor (
    private customMarkupService: CustomMarkupService,
    private customPageService: CustomPageService
  ) { }

  async ngOnInit () {
    this.customPageService.getInstanceHomepage()
      .subscribe(async ({ content }) => {
        const element = await this.customMarkupService.buildElement(content)
        this.contentWrapper.nativeElement.appendChild(element)
      })
  }
}