content: The IonSlides Angular migration guide should have "Notes" about the breaking change on Event handling
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- angular
- Domain
- documentation
Research direction
Open the Angular migration guide at the documented slides Events section and compare its event-handling guidance with the linked Swiper Angular documentation. Add a note describing that Swiper events run outside NgZone and explain when ngZone.run or change detection is needed; done when the breaking change is clear in the guide.
Written by the indexing model from the issue text.
Description
URL
https://ionicframework.com/docs/angular/slides#events
Issue Description
When following the migration guide to switch using Swiper instead of IonSlides, I found one breaking change.
That is the triggered event is no longer part of NgZone.
This is also mentioned in the Swiper document.
https://swiperjs.com/angular#swiper-component-events
Note that Swiper Angular component all events emits outside of NgZone for better perfomance. Dont forget to use
ngzone.runor ChangeDetector if you need to change view (e.g slides) in event handlers (e.gslideChange).
I think this should also be mentioned in the Ionic docs.
Below is a small sample:
In HTML, I put a testVariable both inside and outside of Swiper.
{{testVariable}}
<swiper
[config]="config"
(slideChangeTransitionEnd)="onSlideChange()">
<ng-template swiperSlide>Slide1, {{testVariable}}</ng-template>
<ng-template swiperSlide>Slide2 {{testVariable}}</ng-template>
<ng-template swiperSlide>Slide3 {{testVariable}}</ng-template>
</swiper>
In component code, if I don't surround the code with ngZone.run, only the testVariable inside Swiper is updating, the one outside of Swiper never changes. IonSlides doesn't have such behavior change.
onSlideChange() {
this.ngZone.run(() => {
this.testVariable++;
});
}
- Dominant language
- MDX
- Stars
- 621
- Forks
- 3.2k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 86
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/ionic-docs
-
content
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
ionic-team/ionic-docs#4705 ·
-
content package: angular
Difficulty 2/5 Half a day Newbie friendliness 78/100
ionic-team/ionic-docs#4702 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 80/100
ionic-team/ionic-docs#4546 ·
-
content: broken link Opencontent
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ionic-team/ionic-docs#4381 · 2 comments ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 72/100
ionic-team/ionic-docs#3639 ·
All issues in ionic-team/ionic-docs
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·