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

231
Visualizações
Adding animations to routed components on routing events

I am trying to get it so when the user switches tabs, it will slide between them.

I am using animate.css and version 4 of Angular2.

I detect the router change and add the animation like this:

    this.router.events.pairwise().filter((e) => e[0] instanceof NavigationEnd && e[1] instanceof NavigationStart).subscribe((e: [NavigationStart, NavigationEnd]) => {
            $("#home").addClass("animated slideOutRight").one("animationend", function() {
                $(this).removeClass("animated slideOutRight");
            })
            $("#about").addClass("animated slideInLeft").one("animationend", function() {
                $(this).removeClass("animated slideInLeft");
            })
    });

where #home and #about are the components being routed to. Those two ids are placed to cover HomeComponent and AboutComponent.

  {
    path: 'home',
    component: HomeComponent
  },
  {
    path: 'about',
    component: AboutComponent
  },

The animation works when using something that isn't in the <router-outlet> (eg when using $("body")) so I'm guessing I need to do something differently about the router components.

over 4 years ago · Santiago Trujillo
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