Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nz-carousel with customized dots #1743

Closed
DennisJaamann opened this issue Jun 27, 2018 · 1 comment · Fixed by #1860
Closed

nz-carousel with customized dots #1743

DennisJaamann opened this issue Jun 27, 2018 · 1 comment · Fixed by #1860
Assignees

Comments

@DennisJaamann
Copy link

DennisJaamann commented Jun 27, 2018

What problem does this feature solve?

The "Dots" in this component are always simple styled buttons

nz-carousel.component.html

<div class="slick-initialized slick-slider" [class.slick-vertical]="nzVertical">
  <div class="slick-list" #slickList tabindex="-1" (keydown)="onKeyDown($event)">
    <div class="slick-track" [style.transform]="transform" #slickTrack>
      <ng-content></ng-content>
    </div>
  </div>
  <ul class="slick-dots" *ngIf="nzDots">
    <li
      *ngFor="let content of slideContents; let i =index"
      [class.slick-active]="content.isActive"
      (click)="setActive(content,i)">
      <button>{{i   1}}</button> <!-- this is always fixed, no way to customize the dots -->
    </li>
  </ul>
</div>

Usage

 <nz-carousel [nzEffect]="effect">
   <div nz-carousel-content *ngFor="let index of array"><h3>{{index}}</h3></div>
</nz-carousel>

What does the proposed API look like?

We could pass a custom component as Dots

nz-carousel.component.html

<div class="slick-initialized slick-slider" [class.slick-vertical]="nzVertical">
  <div class="slick-list" #slickList tabindex="-1" (keydown)="onKeyDown($event)">
    <div class="slick-track" [style.transform]="transform" #slickTrack>
      <ng-content select="[nz-carousel-content]"></ng-content>
    </div>
  </div>
<div *ngIf="nzDots">
   <ng-content select="[nz-carousel-dots]"></ng-content><!-- this way, we can customize the dots to have any component! -->
</div>

Usage

 <nz-carousel [nzEffect]="effect">
   <div nz-carousel-content *ngFor="let index of array"><h3>{{index}}</h3></div>
   <div nz-carousel-dots *ngFor="let index of array"><custom-component>{{index}}</custom-component></div>
</nz-carousel>
@lock
Copy link

lock bot commented Jul 22, 2019

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 22, 2019
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants