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

303
Visualizações
Angular 2 (click) and jQuery .clone() method not working

So i have a template for Angular 2 and this template uses jQuery components that "works". Well.. When the page is resized this fire a jQuery function that re-design the sidebar adding all the items of the top navbar using the "clone()" method of jQuery. Something like this:

... code ommited ...
 $navbar = $('nav').find('.navbar-collapse').first().clone(true);
... more code ommited...

This works well, this clone all the items of the navbar on the sidebar. The only problem is a button that i have on the sidebar to logout the system. This is the code:

<a class="text-danger link-pointer" (click)="doLogout()">
    <i class="pe-7s-power"></i> Cerrar Sesión
</a>  

As you can see, i use the (click) binding that call a method of my class. The problem is: When the jQuery clone occours then is cloned, but without the binding. So the link is broken. I can't use the [routerlink] binding because i need execute some code before redirect the user to the logout page.

Any idea to do this? Thanks a lot.

about 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