Add canDeactivateChild guard
- 主要语言
- TypeScript
- 星标
- 101k
- 派生
- 27.5k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 288
描述
**I'm submitting a ...** (check one with "x")
```
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
```
**What is the motivation / use case for changing the behavior?**
There is already a canActivateChild guard. Having the symmetric guard is equally important. Not sure why this wasn't added at the same time. We have many scenarios where we need to protect child routes from navigating away if they have pending unsaved changes. That's currently only possible by putting a canDeactivate guard on each child route.
- **Angular version:** Latest
- **Browser:** all
- **Language:** all
贡献指南
调研方向
该 issue 提议新增一个 Angular 路由 guard:canDeactivateChild,与现有的 canActivateChild guard 对称。首先定位 canActivateChild 的路由实现和测试;该 issue 没有指定文件或测试,因此先确定用于保护存在待保存未保存更改的子路由的 API 和预期行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend, web-dev
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100