[FR] afterClosed for MatMenuTrigger and MatMenu
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
#### Bug, feature request, or proposal:
feature request
#### What is the expected behavior?
I want to be able to detect when a menu is completely closed (after the animation is done)
#### What is the current behavior?
there is a `menuClosed` event that is called when menu is about to be clsoed
#### What is the use-case or motivation for changing an existing behavior?
After menu item selected, I want to update a service the affects the displayed menu panel. Current menuClosed is too early, and it will cause the panel to reflect the change during the close animation.
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
angular 6.0.6, material 6.3.0
#### Is there anything else we should know?
workarounds:
1. ```js
onMenuClosed() {setTimeout(() => { /* doing stuff */ }, 500);}
1. ```js
@ViewChild(MatMenu) myMenu: MatMenu;
// ...
onMenuClosed() {
this.myMenu._animationDone
.pipe(filter(event => event.toState === 'void'), take(1))
.subscribe(() => {
/* doing stuff */
});
}
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia leggendo il ciclo di vita degli eventi di MatMenuTrigger e MatMenu, in particolare l’evento menuClosed esistente e lo stream _animationDone referenziato. Conferma quando termina l’animazione di chiusura e definisci il comportamento pubblico di afterClosed per entrambi i componenti. Il lavoro è completo quando i consumer possono reagire dopo che il menu è stato completamente chiuso senza dipendere da un timeout o da un’API privata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100