diff --git a/src/sortablejs.directive.ts b/src/sortablejs.directive.ts index f4fdc4a..6abce30 100644 --- a/src/sortablejs.directive.ts +++ b/src/sortablejs.directive.ts @@ -55,7 +55,9 @@ export class SortablejsDirective implements OnInit, OnChanges, OnDestroy { } public ngOnDestroy() { - this._sortable.destroy(); + if (this._sortable) { + this._sortable.destroy(); + } } private get options() {