diff --git a/fos/fos-selection/fos-selection.component.ts b/fos/fos-selection/fos-selection.component.ts index e978ea88..64d50cfa 100644 --- a/fos/fos-selection/fos-selection.component.ts +++ b/fos/fos-selection/fos-selection.component.ts @@ -72,8 +72,9 @@ export class FosSelectionComponent { } else { this.activeSection = this.fos[0].id; } - - this.setObserver(); + if(typeof IntersectionObserver !== "undefined") { + this.setObserver(); + } this.cdr.detectChanges(); }); } @@ -93,7 +94,7 @@ export class FosSelectionComponent { this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => { this.keyword = value; this.findMatches(this.keyword); - if (typeof document !== 'undefined') { + if (typeof IntersectionObserver !== 'undefined') { setTimeout(() => { this.setObserver(); }); diff --git a/fos/fos.component.ts b/fos/fos.component.ts index 90664f4b..49edfd5b 100644 --- a/fos/fos.component.ts +++ b/fos/fos.component.ts @@ -105,7 +105,7 @@ export class FosComponent implements OnInit, OnDestroy { this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => { this.keyword = value; this.findMatches(this.keyword); - if (typeof document !== 'undefined') { + if (typeof IntersectionObserver !== 'undefined') { setTimeout(() => { this.setObserver(); });