angular / angular/components

Mat Stepper needs a beforeSelectionChange event

Aperta
#30,292 1 commento 3 reazioni 0 assegnatari Vedi su GitHub
area: material/stepper feature P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la navigazione dell'intestazione di mat stepper e l'evento selectionChange esistente, quindi confronta questo flusso con il punto di ingresso stepper.next() descritto nell'issue. La modifica è completa quando la navigazione dell'intestazione può essere convalidata o impedita prima della selezione, mentre la navigazione programmatica al passaggio successivo continua a funzionare.

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

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.