Skip to content

Commit

Permalink
fix(layout): prevent dom api calls on server (#1107)
Browse files Browse the repository at this point in the history
Fixes #1060
  • Loading branch information
yggg authored and nnixaa committed Dec 26, 2018
1 parent 7e68c20 commit 7511bb0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/framework/theme/components/layout/layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ export class NbLayoutComponent implements AfterViewInit, OnDestroy {
* @returns {NbScrollPosition}
*/
getScrollPosition(): NbScrollPosition {
if (!isPlatformBrowser(this.platformId)) {
return { x: 0, y: 0 };
}

if (this.withScrollValue) {
const container = this.scrollableContainerRef.nativeElement;
return { x: container.scrollLeft, y: container.scrollTop };
Expand Down

0 comments on commit 7511bb0

Please sign in to comment.