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

417
Vistas
In Angular, how would you move a component in the dom?

Started to learn Angular, so this might have a simple answer :)

Without getting to code specific. I'm looking for help, getting in the right direction.

Working on a little shoppinglist application. The point is, when you found something at the grocery store, you click on the item and it move down in a "found items region of the page" click and move below image

atm. the blue components are actually just buttons in the template, but could be anything really. They are instances of a "grocery component", that are nested within a "shopping list" component, build with an ngFor.

In my head it would make sense to work with a single array and filter on that. I've tried that, and it sort of works, but I can't get it to move once the initialization is done. so somehow when I click on a grocery component, I need to tell the shopping list component to move this down in the "grocery found" part of the dom. or vice versa if you want to move it back up.

Any hits or comments would be helpful.

about 4 years ago · Santiago Gelvez
2 Respuestas
Responde la pregunta

0

CDK Drag Drop might be useful in your case

https://material.angular.io/cdk/drag-drop/overview#cdk-drag-drop-connected-sorting

about 4 years ago · Santiago Gelvez Denunciar

0

Have you tested "Dragula"? Here

enter image description here

You can do not only vertical drag&drop, but horizontal as well if you change the direction with the option:

direction:'horizontal'
about 4 years ago · Santiago Gelvez Denunciar
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