ionic-team / ionic-team/ionic-docs

content: document alternative to dismissOnPageChange (ionNavWillChange, ionNavDidChange)

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

描述

**URL**
https://github.com/ionic-team/ionic-framework/blob/main/BREAKING_ARCHIVE/v4.md#overlays

**What is missing or inaccurate about the content on this page?**
The doc says that as a workaround for the removed dismissOnPageChange, `there are global events (ionNavWillChange, ionNavDidChange) that you can listen to in order to detect when navigation occurs.`

I can't find any documentation anywhere on how to actually use ionNavDidChange, so this is not a great proposed alternative.

I managed to get it working using this code in app.component.ts to subscribe to Angular router events:

```
router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
// Do something
}
});
```
Perhaps this should be documented as an alternative to dismissOnPageChange.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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