diff --git a/example/src/app/app.component.html b/example/src/app/app.component.html index a1c7d50..b39d52c 100644 --- a/example/src/app/app.component.html +++ b/example/src/app/app.component.html @@ -28,7 +28,7 @@
Swiper
- +
{{slide}} @@ -36,7 +36,7 @@
-
+
diff --git a/src/lib/swiper.directive.ts b/src/lib/swiper.directive.ts index 5d68fda..dcf4b98 100644 --- a/src/lib/swiper.directive.ts +++ b/src/lib/swiper.directive.ts @@ -111,6 +111,11 @@ export class SwiperDirective implements OnInit, DoCheck, OnDestroy, OnChanges { }; } + if (this.disabled) { + params.allowSlidePrev = false; + params.allowSlideNext = false; + } + if (this.initialIndex != null) { params.initialSlide = this.initialIndex; @@ -189,11 +194,15 @@ export class SwiperDirective implements OnInit, DoCheck, OnDestroy, OnChanges { if (changes['disabled'].currentValue !== changes['disabled'].previousValue) { if (changes['disabled'].currentValue === true) { this.zone.runOutsideAngular(() => { - this.instance.lockSwipes(); + this.ngOnDestroy(); + + this.ngOnInit(); }); } else if (changes['disabled'].currentValue === false) { this.zone.runOutsideAngular(() => { - this.instance.unlockSwipes(); + this.ngOnDestroy(); + + this.ngOnInit(); }); } }