From c563cbfb9efbf412136110478633f87555875c1e Mon Sep 17 00:00:00 2001 From: Stefano Cappa Date: Fri, 10 Aug 2018 19:20:21 +0200 Subject: [PATCH] feat(): add restartCarousel method #144 --- .../lib/components/carousel/carousel.component.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/ks89/angular-modal-gallery/src/lib/components/carousel/carousel.component.ts b/projects/ks89/angular-modal-gallery/src/lib/components/carousel/carousel.component.ts index c5e740cc..14fcd9e9 100644 --- a/projects/ks89/angular-modal-gallery/src/lib/components/carousel/carousel.component.ts +++ b/projects/ks89/angular-modal-gallery/src/lib/components/carousel/carousel.component.ts @@ -411,6 +411,19 @@ export class CarouselComponent extends AccessibleComponent implements OnInit, Af } } + restartCarousel() { + if (isPlatformBrowser(this._platformId)) { + this._ngZone.runOutsideAngular(() => { + this.interval = setInterval(() => { + this._ngZone.run(() => { + this.currentImage = this.images[0]; + this.ref.markForCheck(); + }); + }, this.intervalTime); + }); + } + } + stopCarousel() { if (isPlatformBrowser(this._platformId)) { this._ngZone.runOutsideAngular(() => {