diff --git a/projects/player/src/app/app.component.ts b/projects/player/src/app/app.component.ts index 123c31f28f58a9fa7a1ab7bffd02974d28cb6335..8b25658c0bbe4a9bfbf7f5bd1b85b62a97aff435 100644 --- a/projects/player/src/app/app.component.ts +++ b/projects/player/src/app/app.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { TranslateService } from '@ngx-translate/core'; import { Unit, UnitPage } from '../../../common/unit'; @@ -16,7 +16,7 @@ import { <app-form *ngIf="playerConfig" [pages]=pages [playerConfig]=playerConfig></app-form> ` }) -export class AppComponent { +export class AppComponent implements OnInit { form!: FormGroup; pages!: UnitPage[]; playerConfig!: PlayerConfig; @@ -25,10 +25,13 @@ export class AppComponent { private veronaSubscriptionService: VeronaSubscriptionService, private veronaPostService: VeronaPostService, private nativeEventService: NativeEventService) { + } + + ngOnInit(): void { this.initSubscriptions(); - veronaPostService.sendVopReadyNotification(); - translateService.addLangs(['de']); - translateService.setDefaultLang('de'); + this.veronaPostService.sendVopReadyNotification(); + this.translateService.addLangs(['de']); + this.translateService.setDefaultLang('de'); } private initSubscriptions(): void { diff --git a/projects/player/src/app/components/form.component.ts b/projects/player/src/app/components/form.component.ts index 860aca608a2a3cef3bae472c5f021c4c485e015e..cfcf2de00c24e87776f1051777cbe32b8b921c7f 100644 --- a/projects/player/src/app/components/form.component.ts +++ b/projects/player/src/app/components/form.component.ts @@ -1,4 +1,6 @@ -import { Component, Input, OnDestroy } from '@angular/core'; +import { + Component, Input, OnDestroy, OnInit +} from '@angular/core'; import { FormArray, FormBuilder, FormGroup } from '@angular/forms'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -26,7 +28,7 @@ import { MessageService } from '../../../../common/message.service'; </button> ` }) -export class FormComponent implements OnDestroy { +export class FormComponent implements OnInit, OnDestroy { @Input() pages: UnitPage[] = []; @Input() playerConfig!: PlayerConfig; form!: FormGroup; @@ -38,6 +40,9 @@ export class FormComponent implements OnDestroy { private veronaPostService: VeronaPostService, private messageService: MessageService, private translateService: TranslateService) { + } + + ngOnInit(): void { this.form = this.formBuilder.group({ pages: this.formBuilder.array([]) });