Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda