From 416493787df811638b2e1c3674725c35acc8b35e Mon Sep 17 00:00:00 2001 From: flxi Date: Thu, 18 Jan 2018 16:44:33 +0100 Subject: [PATCH] fix(carousel): toggle carousel-indicators via property (#3319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit сloses #1021 --- .../app/components/+carousel/demos/config/config.ts | 2 +- .../components/+carousel/demos/dynamic/dynamic.html | 5 ++++- .../app/components/+carousel/demos/dynamic/dynamic.ts | 5 +++++ demo/src/ng-api-doc.ts | 11 +++++++++++ src/carousel/carousel.component.html | 2 +- src/carousel/carousel.component.ts | 2 ++ src/carousel/carousel.config.ts | 3 +++ src/spec/carousel.component.spec.ts | 10 ++++++++-- src/spec/ng-bootstrap/carousel.spec.ts | 5 +++++ 9 files changed, 40 insertions(+), 5 deletions(-) diff --git a/demo/src/app/components/+carousel/demos/config/config.ts b/demo/src/app/components/+carousel/demos/config/config.ts index 8d1dc91ec2..af025a8ff2 100644 --- a/demo/src/app/components/+carousel/demos/config/config.ts +++ b/demo/src/app/components/+carousel/demos/config/config.ts @@ -5,7 +5,7 @@ import { CarouselConfig } from 'ngx-bootstrap/carousel'; selector: 'demo-carousel-config', templateUrl: './config.html', providers: [ - { provide: CarouselConfig, useValue: { interval: 1500, noPause: true } } + { provide: CarouselConfig, useValue: { interval: 1500, noPause: true, showIndicators: true } } ] }) export class DemoCarouselConfigComponent {} diff --git a/demo/src/app/components/+carousel/demos/dynamic/dynamic.html b/demo/src/app/components/+carousel/demos/dynamic/dynamic.html index ae8687046d..c2b3f234c2 100644 --- a/demo/src/app/components/+carousel/demos/dynamic/dynamic.html +++ b/demo/src/app/components/+carousel/demos/dynamic/dynamic.html @@ -1,4 +1,4 @@ - + image slide @@ -19,6 +19,9 @@

Slide {{index}}

+
diff --git a/demo/src/app/components/+carousel/demos/dynamic/dynamic.ts b/demo/src/app/components/+carousel/demos/dynamic/dynamic.ts index ac61d5f65b..eb7da2b4ac 100644 --- a/demo/src/app/components/+carousel/demos/dynamic/dynamic.ts +++ b/demo/src/app/components/+carousel/demos/dynamic/dynamic.ts @@ -9,6 +9,7 @@ export class DemoCarouselDynamicComponent { slides: any[] = []; activeSlideIndex: number = 0; noWrapSlides: boolean = false; + showIndicator: boolean = true; constructor() { for (let i = 0; i < 4; i++) { @@ -26,4 +27,8 @@ export class DemoCarouselDynamicComponent { const toRemove = index ? index : this.activeSlideIndex; this.slides.splice(toRemove, 1); } + + switchIndicator(): void { + this.showIndicator = !this.showIndicator; + } } diff --git a/demo/src/ng-api-doc.ts b/demo/src/ng-api-doc.ts index fc46655808..7a2f89739d 100644 --- a/demo/src/ng-api-doc.ts +++ b/demo/src/ng-api-doc.ts @@ -370,6 +370,11 @@ export const ngdoc: any = { "type": "boolean", "description": "

If true — will disable pausing on carousel mouse hover

\n" }, + { + "name": "showIndicators", + "type": "boolean", + "description": "

If true — carousel-indicators are visible

\n" + }, { "name": "noWrap", "type": "boolean", @@ -532,6 +537,12 @@ export const ngdoc: any = { "type": "boolean", "description": "

Is loop of auto changing of slides can be paused

\n" }, + { + "name": "showIndicators", + "defaultValue": "true", + "type": "boolean", + "description": "

Show carousel-indicators

\n" + }, { "name": "noWrap", "defaultValue": "false", diff --git a/src/carousel/carousel.component.html b/src/carousel/carousel.component.html index a8363df0ab..bee77c6994 100644 --- a/src/carousel/carousel.component.html +++ b/src/carousel/carousel.component.html @@ -1,5 +1,5 @@