angular / angular/components

[FR] afterClosed for MatMenuTrigger and MatMenu

Abierto
#11,929 4 comentarios 4 reacciones 0 asignados Ver en GitHub
area: material/menu feature P4
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

#### 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 */
});
}

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza leyendo el ciclo de vida de eventos de MatMenuTrigger y MatMenu, especialmente el evento menuClosed existente y el stream _animationDone referenciado. Confirma cuándo termina la animación de cierre y define el comportamiento público de afterClosed para ambos componentes. La tarea estará terminada cuando los consumidores puedan reaccionar después de que el menú se haya cerrado por completo sin depender de un timeout ni de una API privada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.