Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

106
Visualizações
Angular child animations firing when parent removed from DOM

When a child component has an animation transition that uses query on a mat-rable rows, hiding the parent component will trigger the child animation.

Reproduction scenario: https://codesandbox.io/s/intelligent-jasper-hzmxvy

This doesn't happen anymore if i declare the fadeOut in the AppComponent also.

@Component({ selector: "app-root", templateUrl: "./app.component.html", styleUrls: ["./app.component.css"], animations: [fadeOut()] })

Tried with other type of elements, didn't reproduce it with anything other than mat-table rows.

As Angular documentation states: https://angular.io/guide/transition-and-triggers#use-of-ngif-and-ngfor-with-enter-and-leave "Note: Entering/leaving behaviors can sometime be confusing. As a rule of thumb consider that any element being added to the DOM by Angular passes via the :enter transition, but only elements being directly removed from the DOM by Angular pass via the :leave transition (e.g. an element's view is removed from the DOM because its parent is being removed from the DOM or the app's route has changed, then the element will not pass via the :leave transition)."

I was expecting that the child animation wouldn't trigger at all, in any case.

Am i missing something?

Thank you for any responses that you may have!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

What is the desired behavior you are after - what would you like/expect to happen?

I have a few ideas why this may be, but again, I would need to know what the exact question is.

It may have to do with the fact that the table cells are targeted by the animation:

query("td", animate("2000ms", style({ position: "absolute" })))

Or the fact that an ng-container is used and this might not count as a parent element.

Looking forward to hearing from you.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda