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

ionic slides shows first image only #259

Closed
myrsk opened this issue Jan 3, 2018 · 6 comments
Closed

ionic slides shows first image only #259

myrsk opened this issue Jan 3, 2018 · 6 comments

Comments

@myrsk
Copy link

myrsk commented Jan 3, 2018

Hello,

Having similar issue to #256

However, since it is a closed issue, I have created a new open one.

However, when i tried to use the same fix. I am getting a runtime error on ionic 3

page.ts - here im getting a debug notice on Subject not found. TS.

imageChange$ = new Subject();

  slideChanged() {
    this.imageChange$.next();
  }

page.html

<ion-slides *ngIf="(item | async).image1" class="image-slider" loop="true" slidesPerView="2" (ionSlideDidChange)="slideChanged()">
        <ion-slide *ngIf="(item | async).image1">
          <img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="(item | async).image1" class="thumb-img" imageViewer [scrollObservable]="imageChange$" [offset]="'100'">
        </ion-slide>
        <ion-slide *ngIf="(item | async).image2">
            <img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="(item | async).image2" class="thumb-img" imageViewer [scrollObservable]="imageChange$" [offset]="'100'">
          </ion-slide>
          <ion-slide *ngIf="(item | async).image3">
              <img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="(item | async).image3" class="thumb-img" imageViewer [scrollObservable]="imageChange$" [offset]="'100'">
            </ion-slide>
            <ion-slide *ngIf="(item | async).image4">
                <img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="(item | async).image4" class="thumb-img" imageViewer [scrollObservable]="imageChange$" [offset]="'100'">
              </ion-slide>
              <ion-slide *ngIf="(item | async).image5">
                  <img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="(item | async).image5" class="thumb-img" imageViewer [scrollObservable]="imageChange$" [offset]="'100'">
                </ion-slide>
                <ion-slide *ngIf="(item | async).image6">
                    <img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="(item | async).image6" class="thumb-img" imageViewer [scrollObservable]="imageChange$" [offset]="'100'">
                  </ion-slide>
      </ion-slides>
    </ion-card>

Uncaught (in promise): ReferenceError: Subject is not defined ReferenceError: Subject is not defined

@tjoskar
Copy link
Owner

tjoskar commented Jan 7, 2018

Hi @myrsk,
Have you imported Subject from rxjs? Like this: import { Subject } from 'rxjs/Subject';?

@myrsk
Copy link
Author

myrsk commented Jan 7, 2018

@tjoskar unfortunately, since I couldn't get it to work for some days, I had to remove it and used a different approach.

I will try this though, not sure 100% if i did import.

Thanks.

@myrsk myrsk closed this as completed Jan 7, 2018
@tjoskar
Copy link
Owner

tjoskar commented Jan 7, 2018

@myrsk, I see, let me know if it doesn't solve your issue.

@sabiridwan
Copy link

hi please any solution for this issue ? for now i am setting my images to default image.

@tjoskar
Copy link
Owner

tjoskar commented Apr 24, 2018

Hi @sabiridwan,
Do you get the same error, ReferenceError: Subject is not defined ReferenceError: Subject is not defined? In any case, please open a new issue and I will try to help you.

@sabiridwan
Copy link

Hi @tjoskar thanks..
i worked when i use
<ion-slide #swiper>
<img [defaultImage]="defaultImage" [lazyLoad]="image" [scrollObservable]="swiper.ionSlideWillChange" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants