Update Thanks to @cookiecookson from the Slack channel:
This seems to be a bug in the ionic implementation of the Swiper shell. One way to solve it is to use another shell for the Swiper library, like this one . You can find a demo application in this github repo .
The end result will be something like this:
t
First you need to install it
npm install angular2-swiper
Then import it into the app.module.ts file (or the desired module)
import { KSSwiperModule } from 'angular2-swiper'; // ... @NgModule({ declarations: [...], imports: [KSSwiperModule, ...], bootstrap: [...], entryComponents: [..], providers: [...] }) export class AppModule { }
And then just use it on your page.
Component Code:
import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; @Component({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage { public items_a: Array<any>; public items_b: Array<any>; public options: any; constructor(public navCtrl: NavController) { this.items_a = [ { gameTitle: 'Title1', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title2', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title3', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title4', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title5', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title6', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title7', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title8', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title9', gameImage: 'http://via.placeholder.com/200x200' } ]; this.items_b = [ { gameTitle: 'Title10', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title11', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title12', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title13', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title14', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title15', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title16', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title17', gameImage: 'http://via.placeholder.com/200x200' }, { gameTitle: 'Title18', gameImage: 'http://via.placeholder.com/200x200' } ]; this.options = { slidesPerView: 3 } } }
View:
<ion-header> <ion-navbar> <ion-title> Multiple slides </ion-title> </ion-navbar> </ion-header> <ion-content padding> <ks-swiper-container [options]="options"> <ks-swiper-slide *ngFor="let slide of items_a"> <ion-card class="list-card"> <div class="cardInnerWrap"> <ion-item> {{ slide.gameTitle }} </ion-item> <img src="{{ slide.gameImage }}"> </div> </ion-card> </ks-swiper-slide> </ks-swiper-container> <ks-swiper-container [options]="options"> <ks-swiper-slide *ngFor="let slide of items_b"> <ion-card class="list-card"> <div class="cardInnerWrap"> <ion-item> {{ slide.gameTitle }} </ion-item> <img src="{{ slide.gameImage }}"> </div> </ion-card> </ks-swiper-slide> </ks-swiper-container> </ion-content>