Skip to content

Commit

Permalink
fix: restore compatibility with universal
Browse files Browse the repository at this point in the history
Closes #83
  • Loading branch information
philip-firstorder authored and mattlewis92 committed Feb 28, 2019
1 parent 2c2c74c commit 210decc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/resizable.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import {
OnDestroy,
NgZone,
OnChanges,
SimpleChanges
SimpleChanges,
Inject,
PLATFORM_ID
} from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { Subject, Observable, Observer, merge, EMPTY } from 'rxjs';
import {
map,
Expand Down Expand Up @@ -374,6 +377,7 @@ export class ResizableDirective implements OnInit, OnChanges, OnDestroy {
* @hidden
*/
constructor(
@Inject(PLATFORM_ID) private platformId: any,
private renderer: Renderer2,
public elm: ElementRef,
private zone: NgZone
Expand Down Expand Up @@ -785,7 +789,10 @@ export class ResizableDirective implements OnInit, OnChanges, OnDestroy {
* @hidden
*/
ngOnDestroy(): void {
this.renderer.setStyle(document.body, 'cursor', '');
// browser check for angular universal, because it doesn't know what document is
if (isPlatformBrowser(this.platformId)) {
this.renderer.setStyle(document.body, 'cursor', '');
}
this.mousedown.complete();
this.mouseup.complete();
this.mousemove.complete();
Expand Down

0 comments on commit 210decc

Please sign in to comment.