bug(autocomplete): DisplayWith retriggering + Programmatical value selection
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
1. It's impossible to retrigger displayWith method (only when resetting form value).
2. Initial data is not displayed on dropdown with checkmark symbol, when property is binded. After selection all is working
2.1 When changing value programatically, checkmark is displayed on wrong selection.
### Reproduction
StackBlitz link: https://stackblitz.com/edit/zkwk2u
Steps to reproduce:
1. Change language
2. Value is not translated + not possible trigger displayWith. I tried different things, even updateValueAndValidity on formControl, which should really execute ValueChanges. Only when changing property value with setValue, it triggers displayWith method. With this approach I saw second problem, with programmatically changing control value.
1. Open link, selected value is displayed correctly with displayWith
2. Open dropdown no selection is displayed.
3. Select new value (first value) from dropdown (value is displayed correctly with check mark)
4. Click button (it changes value to 3, 3rd selection)
5. Value change is triggered and input shows correct data.
6. Open dropdown, it still shows wrong selection
### Expected Behavior
1. It's possible to trigger programmatically displayWith
2. Programmatically selected value + initial value is displayed correctly
### Actual Behavior
1. When already displayed value with displayWith, then this is not possible to change
2. Selection is not shown or shown wrongly
### Environment
- Angular: 17.0.0
- CDK/Material: 17.0.1
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):
贡献指南
调研方向
从链接的 StackBlitz 复现开始,检查 Angular Material autocomplete 在 displayWith、初始值以及以编程方式进行的 setValue 更改方面的行为。当 displayWith 可以通过编程方式重新触发,并且下拉菜单中的复选标记能够正确跟踪初始选中的值和通过编程方式选中的值时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100