Skip to content

Commit c2a0c8b

Browse files
authored
fix for ngOnDestroy throws error when in SSR - resolves #163 (#263)
fix for ngOnDestroy throws error when in SSR - resolves #163
1 parent 8976873 commit c2a0c8b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
1414
- Stop using getters in template ([3858dde](https://github.com/vlio20/angular-datepicker/commit/3858dde)) closes [#239](https://github.com/vlio20/angular-datepicker/issues/239)
1515

1616
### Bug Fixed
17+
- fix for `ngOnDestroy` throws error when in SSR ([???](https://github.com/vlio20/angular-datepicker/commit/???)) closes [#163](https://github.com/vlio20/angular-datepicker/issues/163)
1718
- `displayDate` on the directive bug fix ([984aab8](https://github.com/vlio20/angular-datepicker/commit/984aab8)) closes [#254](https://github.com/vlio20/angular-datepicker/issues/254)
1819
- `max`/`min` date support for strings ([ad98d1b](https://github.com/vlio20/angular-datepicker/commit/ad98d1b)) closes [#250](https://github.com/vlio20/angular-datepicker/issues/250)
1920
- `value.split` is not a function bug fix ([38f6ce2](https://github.com/vlio20/angular-datepicker/commit/38f6ce2)) closes [#225](https://github.com/vlio20/angular-datepicker/issues/245)

src/app/date-picker/date-picker.component.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ export class DatePickerComponent implements OnChanges,
427427

428428
ngOnDestroy() {
429429
this.handleInnerElementClickUnlisteners.forEach(ul => ul());
430-
this.appendToElement.removeChild(this.calendarWrapper);
430+
431+
if (this.appendToElement) {
432+
this.appendToElement.removeChild(this.calendarWrapper);
433+
}
431434
}
432435
}

0 commit comments

Comments
 (0)