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

125
Vistas
How can I fetch nodelist with document.querySelectorAll in Angular?

This is a part of an e-commerce app in which customers can select an order and go to checkout. A group of similar buttons that have a data- attribute, with respective extensions to data-something. I am able to implement this well in JavaScript and Html 5. I want to know how to achieve exactly the same using Angular.

    
          <button data-plan="bronze">Select Plan</button>
          <button data-plan="silver">Select Plan</button>
          <button data-plan="gold">Select Plan</button>
          <button data-plan="diamond">Select Plan</button>

Below is JavaScript I wish to implement in Angular,

// Select Plan Logic
    const planButtons = document.querySelectorAll("button[data-plan]");
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

To interact with HTML elements in Angular and have references on them you should use @ViewChild or @ViewChildren decorators. First one is for only one element and second one for more than one.

When using these decorators you should consider ngAfterViewInit lifecycle method in which you can access references to DOM elements. Under the hood, @ViewChild or @ViewChildren are using document.querySelector and document.querySelectorAll.

Learn and read more about them:

https://angular.io/api/core/ViewChild

https://angular.io/api/core/ViewChildren

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