diff --git a/src/atlasViewer/atlasViewer.component.ts b/src/atlasViewer/atlasViewer.component.ts index 7d26de77b4a701fbed50b629f020787065eeed45..c5736694e5a915db6f5fa464406d8fefd0a81acd 100644 --- a/src/atlasViewer/atlasViewer.component.ts +++ b/src/atlasViewer/atlasViewer.component.ts @@ -301,14 +301,20 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit { /** * Show Cookie disclaimer if not yet agreed */ - if (localStorage.getItem('cookies') !== 'agreed') { + /** + * TODO avoid creating new views in lifecycle hooks in general + */ + of(localStorage.getItem('cookies') !== 'agreed').pipe( + delay(0), + filter(flag => flag) + ).subscribe(() => { this.modalService.show(ModalUnit, { initialState: { title: 'Cookie Disclaimer', - template: this.cookieAgreementComponent, + template: this.cookieAgreementComponent } - }); - } + }) + }) this.onhoverSegmentForFixed$ = this.rClContextualMenu.onShow.pipe( withLatestFrom(this.onhoverSegment$), diff --git a/src/ui/cookieAgreement/cookieAgreement.component.ts b/src/ui/cookieAgreement/cookieAgreement.component.ts index f5ee943abdf4a432d915d16a18d7019c641092b8..e52f59c5be1878198d2c3321c10daa19486fbeef 100644 --- a/src/ui/cookieAgreement/cookieAgreement.component.ts +++ b/src/ui/cookieAgreement/cookieAgreement.component.ts @@ -9,5 +9,5 @@ import { Component, ChangeDetectionStrategy } from '@angular/core' changeDetection: ChangeDetectionStrategy.OnPush }) export class CookieAgreement { - showMore = false; + public showMore:boolean = false } \ No newline at end of file diff --git a/src/ui/cookieAgreement/cookieAgreement.template.html b/src/ui/cookieAgreement/cookieAgreement.template.html index bfa30096071a9697a97678a96840df617aab1894..316ca3d43c8ea1a97f94e10bfb87e02b0a98560f 100644 --- a/src/ui/cookieAgreement/cookieAgreement.template.html +++ b/src/ui/cookieAgreement/cookieAgreement.template.html @@ -11,8 +11,11 @@ <p>To opt-out of being tracked by Google Analytics across all websites, visit <a href="http://tools.google.com/dlpage/gaoptout">http://tools.google.com/dlpage/gaoptout</a> .</p> - <button class="btn btn-outline-info btn-block mb-2" (click)="showMore = !showMore">Show - {{showMore? "less" : "more"}}</button> + <button + class="btn btn-outline-info btn-block mb-2" + (click)="showMore = !showMore"> + Show {{showMore? "less" : "more"}} + </button> <div *ngIf="showMore"> <small>