Skip to content
This repository has been archived by the owner on Aug 6, 2022. It is now read-only.

Commit

Permalink
Fixed typo in directive that broke events sending
Browse files Browse the repository at this point in the history
  • Loading branch information
sconix committed May 23, 2018
1 parent 7a985a5 commit 55fecf7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions example/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
<div class="box-title">Swiper</div>

<div class="content-container" fxLayout="column" fxLayoutAlign="stretch" fxFlex="auto">
<swiper *ngIf="type == 'component' && show" class="swiper-container" fxFlex="auto" [config]="config" [disabled]="disabled" (indexChange)="onIndexChange($event)" (swiperTransitionEnd)="onTransitionEnd($event)">
<swiper *ngIf="type == 'component' && show" class="swiper-container" fxFlex="auto" [config]="config" [disabled]="disabled" (indexChange)="onIndexChange($event)" (swiperTransitionStart)="onSwiperEvent('transitionStart')" (swiperTransitionEnd)="onSwiperEvent('transitionEnd')">
<div *ngFor="let slide of slides" class="swiper-slide">
<div fxLayout="column" fxLayoutAlign="center center" fxFlexFill>
{{slide}}
</div>
</div>
</swiper>

<div *ngIf="type == 'directive' && show" class="swiper-container" [disabled]="disabled" [swiper]="config" (indexChange)="onIndexChange($event)" (swiperTransitionEnd)="onTransitionEnd($event)">
<div *ngIf="type == 'directive' && show" class="swiper-container" [disabled]="disabled" [swiper]="config" (indexChange)="onIndexChange($event)" (swiperTransitionStart)="onSwiperEvent('transitionStart')" (swiperTransitionEnd)="onSwiperEvent('transitionEnd')">
<div class="swiper-wrapper">
<div *ngFor="let slide of slides" class="swiper-slide">
<div fxLayout="column" fxLayoutAlign="center center" fxFlexFill>
Expand Down
2 changes: 1 addition & 1 deletion example/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class AppComponent {
console.log('Swiper index: ', index);
}

public onTransitionEnd(event: any[]): void {
public onSwiperEvent(event: string): void {
console.log('Swiper event: ', event);
}
}
2 changes: 1 addition & 1 deletion src/lib/swiper.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class SwiperDirective implements AfterViewInit, OnDestroy, DoCheck, OnCha
SwiperEvents.forEach((eventName: SwiperEvent) => {
let swiperEvent = eventName.replace('swiper', '');

swiperEvent = eventName.charAt(0).toLowerCase() + eventName.slice(1);
swiperEvent = swiperEvent.charAt(0).toLowerCase() + swiperEvent.slice(1);

this.instance.on(swiperEvent, (...args: any[]) => {
if (args.length === 1) {
Expand Down

0 comments on commit 55fecf7

Please sign in to comment.