Skip to content

Commit

Permalink
fix(angular): nested swiper (#4785)
Browse files Browse the repository at this point in the history
* fix(angular): nested swiper

* fix(angular): nested swiper better example
  • Loading branch information
vltansky authored Jul 21, 2021
1 parent adac257 commit 2be958c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions playground/angular/src/app/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<main>
<div>
<h4>Nested</h4>
<swiper direction="horizontal">
<ng-container *ngFor="let item of [].constructor(4); let i = index">
<ng-template swiperSlide> test {{ i + 1 }} </ng-template>
</ng-container>
<ng-template swiperSlide> test 5 </ng-template>
<ng-template swiperSlide>
<swiper direction="vertical">
<ng-template swiperSlide> test vertical 1 </ng-template>
<ng-template swiperSlide> test vertical 2 </ng-template>
</swiper>
</ng-template>
</swiper>
</div>
<div>
<h4>Default: Not in NgZone</h4>
<swiper [virtual]="true">
Expand Down
2 changes: 1 addition & 1 deletion src/angular/src/swiper.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class SwiperComponent implements OnInit {
this._setElement(el, this.pagination, 'pagination');
}
_paginationElRef: ElementRef;
@ContentChildren(SwiperSlideDirective, { descendants: true, emitDistinctChangesOnly: true })
@ContentChildren(SwiperSlideDirective, { descendants: false, emitDistinctChangesOnly: true })
slidesEl: QueryList<SwiperSlideDirective>;
private slides: SwiperSlideDirective[];

Expand Down

0 comments on commit 2be958c

Please sign in to comment.