angular / angular/components

Mat Stepper needs a beforeSelectionChange event

Ouverte
#30,292 1 commentaire 3 réactions 0 personnes assignées Voir sur GitHub
area: material/stepper feature P4
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

### Feature Description

There should be an event that is triggered when you attempt to navigate to a different step via the mat stepper header.

Currently, there is only a `selectionChange` event that doesn't get triggered until _after_ the next navigation takes place.

### Use Case

In my scenario, when a user attempts to navigate to the next step, I need to first call an endpoint to validate the data they entered. Once I have validated that the data is correct, I can proceed to the next step with `stepper.next()`. This works as expected if the user clicks on my next button with a custom `(click)` event, but if they click on the header to navigate, there is no way to call the endpoint before navigation.

Using `selectionChange` does not work, because there is no way to prevent navigation after the `StepperSelectionEvent` has happened.

Alternatively, instead of a `beforeSelectionChange` event, if there were a way to prevent the next navigation when subscribing to the `selectionChange` event, that would also work. Or if there was a way to prevent navigation from the header, but still capture clicks, so that `stepper.next` could manually be called.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la navigation de l’en-tête de mat stepper et l’événement selectionChange existant, puis comparez ce flux avec le point d’entrée stepper.next() décrit dans l’issue. La modification est terminée lorsque la navigation de l’en-tête peut être validée ou empêchée avant la sélection, tandis que la navigation programmatique vers l’étape suivante continue de fonctionner.

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

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

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