This is an Angular 2 wrapper library for swiper.
See a live example application here.
npm install
npm run build
cd example
npm install
npm start
npm install angular2-swiper-wrapper --save-dev
import { SwiperModule } from 'angular2-swiper-wrapper';
import { SwiperConfigInterface } from 'angular2-swiper-wrapper';
const SWIPER_CONFIG: SwiperConfigInterface = {
direction: 'horizontal',
slidesPerView: 'auto',
keyboardControl: true
};
@NgModule({
...
imports: [
...
SwiperModule.forRoot(SWIPER_CONFIG)
]
})
<swiper-view [config]="config" (indexChange)="onIndexChange($event)">
<swiper-item>
Swiper content
</swiper-item>
</swiper-view>
[config] // Custom config to override the global defaults.
(indexChange) // Event handler for the swiper index change.
direction // Direction of the swiper (Default: 'horizontal').
threshold // Distance needed for the swipe action (Default: 0).
spaceBetween // Space in pixels between the swiper items (Default: 0).
slidesPerView // Number of the items per view or 'auto' (Default: 1).
centeredSlides // Align active item on center not left (Default: false).
keyboardControl // Enables navigation through arrow keys (Default: false).
For more detailed documentation with all the supported options see swiper documentation.