angular / angular/components

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

Aperta
#12,754 6 commenti 9 reazioni 0 assegnatari Vedi su GitHub
area: material/sort P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### 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).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dalla riproduzione StackBlitz collegata e dalla direttiva matSort di Angular Material, quindi riproduci il caso in cui matSortActive e matSortDirection cambiano insieme. La correzione è completa quando la modifica di entrambe le proprietà associate mantiene visibile la freccia di ordinamento nella direzione richiesta, con un test di regressione che copra questo aggiornamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.