JayChase / ngx-useful-swiper

Use iDangero.us' great slider, Swiper in Angular.
17 stars 9 forks source link

Angular Thumbs Gallery #8

Open xBelabz opened 4 years ago

xBelabz commented 4 years ago

Hi, I'm trying to make the Thumbs Gallery works with Angular but i got this error: Cannot read property 'addClass' of undefined at Swiper.init

Here is my configs:

public galleryThumbs: any = {
    spaceBetween: 10,
    slidesPerView: 4,
    freeMode: true,
    watchSlidesVisibility: true,
    watchSlidesProgress: true,
  }

  public galleryTop: any = {
    spaceBetween: 10,
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },
    thumbs: {
      swiper: this.galleryThumbs
    }
  }

Here's my HTML:

<swiper [config]="galleryTop">
  <div class="swiper-container gallery-top">
    <div class="swiper-wrapper">
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
      <div class="swiper-slide"></div>
    </div>
  </div>
</swiper>

<swiper [config]="galleryThumbs">
<div class="swiper-container gallery-thumbs">
  <div class="swiper-wrapper">
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
    <div class="swiper-slide"></div>
  </div>
</div>
</swiper>

<!-- Add Arrows -->
<div class="swiper-button-next swiper-button-white"></div>
<div class="swiper-button-prev swiper-button-white"></div>

Any advice please would be appreciated. All the best.