Fix intersaction Observer in fos-selections.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-17 12:40:30 +03:00
parent 2f98910712
commit 3e12962add
2 changed files with 5 additions and 4 deletions

View File

@ -72,8 +72,9 @@ export class FosSelectionComponent {
} else { } else {
this.activeSection = this.fos[0].id; this.activeSection = this.fos[0].id;
} }
if(typeof IntersectionObserver !== "undefined") {
this.setObserver(); this.setObserver();
}
this.cdr.detectChanges(); this.cdr.detectChanges();
}); });
} }
@ -93,7 +94,7 @@ export class FosSelectionComponent {
this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => { this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
this.keyword = value; this.keyword = value;
this.findMatches(this.keyword); this.findMatches(this.keyword);
if (typeof document !== 'undefined') { if (typeof IntersectionObserver !== 'undefined') {
setTimeout(() => { setTimeout(() => {
this.setObserver(); this.setObserver();
}); });

View File

@ -105,7 +105,7 @@ export class FosComponent implements OnInit, OnDestroy {
this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => { this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
this.keyword = value; this.keyword = value;
this.findMatches(this.keyword); this.findMatches(this.keyword);
if (typeof document !== 'undefined') { if (typeof IntersectionObserver !== 'undefined') {
setTimeout(() => { setTimeout(() => {
this.setObserver(); this.setObserver();
}); });