File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 7
7
*/
8
8
import { Directive , Input ,
9
9
OnDestroy , AfterViewInit , ElementRef , Optional } from '@angular/core' ;
10
+ import { Platform } from '../core/platform' ;
10
11
import { Scrollable } from '../core/overlay/scroll/scrollable' ;
11
12
import { extendObject } from '../core/util/object-extend' ;
12
13
import { Observable } from 'rxjs/Observable' ;
@@ -96,10 +97,13 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
96
97
97
98
constructor ( element : ElementRef ,
98
99
scrollable : Scrollable ,
99
- @Optional ( ) public parentRegion : CdkStickyRegion ) {
100
- this . element = element . nativeElement ;
101
- this . upperScrollableContainer = scrollable . getElementRef ( ) . nativeElement ;
102
- this . setStrategyAccordingToCompatibility ( ) ;
100
+ @Optional ( ) public parentRegion : CdkStickyRegion ,
101
+ platform : Platform ) {
102
+ if ( platform . isBrowser ) {
103
+ this . element = element . nativeElement ;
104
+ this . upperScrollableContainer = scrollable . getElementRef ( ) . nativeElement ;
105
+ this . setStrategyAccordingToCompatibility ( ) ;
106
+ }
103
107
}
104
108
105
109
ngAfterViewInit ( ) : void {
You can’t perform that action at this time.
0 commit comments