Skip to content

Commit

Permalink
feat(angular): config input support
Browse files Browse the repository at this point in the history
  • Loading branch information
vltansky committed Dec 9, 2020
1 parent e66c241 commit f7d21c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions playground-angular/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
>
</ng-container>
</swiper>
<swiper [config]="{ slidesPerView: 3 }">
<ng-template swiperSlide>Best slide ever 2</ng-template>
<ng-template swiperSlide>Best slide ever 2</ng-template>
<ng-template swiperSlide>Best slide ever 2</ng-template>
<ng-template swiperSlide>Best slide ever 2</ng-template>
<ng-template swiperSlide>Best slide ever 2</ng-template>
</swiper>
<button (click)="togglePagination()">Toggle pagination</button>
<button (click)="toggleNavigation()">Toggle navigation</button>
<button (click)="toggleScrollbar()">Toggle scrollbar</button>
Expand Down
6 changes: 6 additions & 0 deletions src/angular/src/swiper.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ export class SwiperComponent implements OnInit {
return this._virtual;
}
private _virtual: SwiperOptions['virtual'];

@Input()
set config(val: SwiperOptions) {
const { params } = getParams(val);
Object.assign(this, params);
}
// prettier-ignore
@Output('_beforeBreakpoint') s__beforeBreakpoint: EventEmitter<SwiperEvents['_beforeBreakpoint']> = new EventEmitter<any>();
// prettier-ignore
Expand Down

0 comments on commit f7d21c5

Please sign in to comment.