Bug: matSortDirection will not work if matSortActive had changed in matSort directive.
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
#### Bug, feature request, or proposal:
**Bug!**
#### What is the expected behavior?
In the table element with sort-header - matSort directive - the properties **matSortActive** and **matSortDirection** will work independently.
#### What is the current behavior?
The **matSortDirection** property will work only if **matSortActive** didn't changed
#### What are the steps to reproduce?
1. Create a new Component. In it's template (html file) create a table element with **matSort** directive.
2. Add to this table the properties [matSortActive] and [matSortDirection] and bind them to variables in your Component
3. In the Component initialization (constructor or ngInit) set values for the variables binded to matSortActive and matSortDirection.
4. Add a method_1 that will update the matSortDirection only - **Verify:** The Sort-Arrow in the table's header appear in the right direction (asc/desc).
5. Add a method_2 that will update the matSortDirection **and** matSortActive - **Bug:** The Sort-Arrow in the table's header is missing!!!
Providing a StackBlitz reproduction is the *best* way to share your issue.
StackBlitz starter:
View and Edit: https://stackblitz.com/edit/angular-41eoff?file=main.ts
View Only: https://angular-41eoff.stackblitz.io
#### What is the use-case or motivation for changing an existing behavior?
Fixing the bug and providing a current behavior for these 2 properties (matSortActive and matSortDirection).
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
- Angular v6.1.3
- Material v6.4.5
- TypeScript v2.9.2
- Browsers: Tested in Chrome, Opera (maybe others).
贡献指南
调研方向
先从链接的 StackBlitz 复现和 Angular Material 的 matSort 指令开始,然后复现 matSortActive 和 matSortDirection 同时发生变化的情况。当同时更改这两个绑定属性后,排序箭头仍能按请求的方向显示,并且有一个覆盖该更新的回归测试时,修复才算完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100