angular / angular/components

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

Ouverte
#12,754 6 commentaires 9 réactions 0 personnes assignées Voir sur GitHub
area: material/sort P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée et la directive matSort d’Angular Material, puis reproduisez le cas où matSortActive et matSortDirection changent ensemble. Le correctif est terminé lorsque la modification des deux propriétés liées maintient la flèche de tri visible dans la direction demandée, avec un test de régression couvrant cette mise à jour.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.