angular / angular/components

Bug: matSortDirection will not work if matSortActive had changed in matSort directive.

オープン
#12,754 コメント 6 件 リアクション 9 件 担当者 0 名 GitHub で見る
area: material/sort P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。