diff --git a/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts b/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts index 753dcdea..d2213af9 100644 --- a/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts +++ b/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, NgZone, ViewChild } from '@angular/core'; +import { Component, Inject, NgZone, OnDestroy, ViewChild } from '@angular/core'; import { CdkTextareaAutosize } from '@angular/cdk/text-field'; import { take } from 'rxjs/operators'; import { MAT_DIALOG_DATA } from '@angular/material/dialog'; @@ -8,13 +8,15 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog'; templateUrl: './info-dialog.component.html', styleUrls: ['./info-dialog.component.css'], }) -export class InfoDialogComponent { +export class InfoDialogComponent implements OnDestroy { title: string; subtitle: string; updateFunction: () => Promise; textAreaValue: string; + interval; + @ViewChild('autosize') autosize: CdkTextareaAutosize; constructor( @@ -31,6 +33,9 @@ export class InfoDialogComponent { this.updateFunction = data.updateFunction; this.updateValue(); + this.interval = setInterval(() => { + this.updateValue(); + }, 700); // this.publisher // .getSenders() @@ -70,6 +75,10 @@ export class InfoDialogComponent { // }); } + ngOnDestroy() { + clearInterval(this.interval); + } + async updateValue() { this.textAreaValue = await this.updateFunction(); this.triggerResize();