ionic-team / ionic-team/ionic-docs

content: The IonSlides Angular migration guide should have "Notes" about the breaking change on Event handling

未关闭
#2,734 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
content
主要语言
MDX
星标
621
派生
3.2k
平均合并
1 天 2 小时
30 天内合并 PR
86

描述

### 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.run` or ChangeDetector if you need to change view (e.g slides) in event handlers (e.g `slideChange`).

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}}

Slide1, {{testVariable}}
Slide2 {{testVariable}}
Slide3 {{testVariable}}

```
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++;
});
}
```

贡献指南

打开贡献指南

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
angular
领域
documentation
Issue 类型
文档
难度
1/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。