diff --git a/projects/player/src/app/directives/section-visibility-handling.directive.ts b/projects/player/src/app/directives/section-visibility-handling.directive.ts index 3bdac732cfddd14f998e57c7085cee08a0c72b81..a40f0c3d43dbd73634175fd50ce271c44097bf2d 100644 --- a/projects/player/src/app/directives/section-visibility-handling.directive.ts +++ b/projects/player/src/app/directives/section-visibility-handling.directive.ts @@ -1,5 +1,5 @@ import { Directive, ElementRef, Input } from '@angular/core'; -import { delay, Subject } from 'rxjs'; +import { delay, Subject, Subscription } from 'rxjs'; import { Section } from 'common/models/section'; import { takeUntil } from 'rxjs/operators'; import { ElementCodeStatusValue } from 'player/modules/verona/models/verona'; @@ -28,7 +28,11 @@ export class SectionVisibilityHandlingDirective { .pipe( takeUntil(this.ngUnsubscribe), delay(this.section.activeAfterIdDelay)) - .subscribe((id: string): void => this.setActiveAfterID(id)); + .subscribe((id: string): void => { + this.ngUnsubscribe.next(); + this.ngUnsubscribe.complete(); + this.setActiveAfterID(id); + }); } }