Skip to content

Commit 38e0e6c

Browse files
committed
fix(ssr): Add platformBrowser check #6199
1 parent d230773 commit 38e0e6c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

projects/igniteui-angular/src/lib/carousel/carousel.component.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
Output
1313
} from '@angular/core';
1414
import { IgxIconModule } from '../icon/index';
15-
import { IBaseEventArgs } from '../core/utils';
15+
import { IBaseEventArgs, PlatformUtil } from '../core/utils';
1616

1717
let NEXT_ID = 0;
1818

@@ -112,8 +112,10 @@ export class IgxCarouselComponent implements OnDestroy {
112112
* @memberof IgxCarouselComponent
113113
*/
114114
set interval(value: number) {
115-
this._interval = +value;
116-
this._restartInterval();
115+
if (this._platformBrowser) {
116+
this._interval = +value;
117+
this._restartInterval();
118+
}
117119
}
118120
/**
119121
* Returns the `tabIndex` of the carousel component.
@@ -201,8 +203,11 @@ export class IgxCarouselComponent implements OnDestroy {
201203
private _currentSlide: IgxSlideComponent;
202204
private _destroyed: boolean;
203205
private _total = 0;
206+
private _platformBrowser: boolean;
204207

205-
constructor(private element: ElementRef) { }
208+
constructor(private element: ElementRef, private platformUtil: PlatformUtil) {
209+
this._platformBrowser = this.platformUtil.isBrowser;
210+
}
206211
/**
207212
*@hidden
208213
*/

0 commit comments

Comments
 (0)