Skip to content

Commit ac9633d

Browse files
author
Mark
committed
fix: Cannot read property 'slick' of undefined issue when navigating
1 parent 0db4336 commit ac9633d

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-slick",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"scripts": {
55
"build": "gulp build",
66
"build:watch": "gulp",

Diff for: src/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-slick",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/devmark/ngx-slick"

Diff for: src/slick.component.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,12 @@ export class SlickComponent implements AfterViewInit, OnDestroy {
153153
}
154154

155155
public unslick() {
156-
this.zone.run(() => {
157-
this.$instance.slick('unslick');
158-
});
156+
if (this.$instance) {
157+
this.zone.run(() => {
158+
this.$instance.slick('unslick');
159+
});
160+
}
161+
this.initialized = false;
159162
}
160163

161164
}

0 commit comments

Comments
 (0)