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

258
Vistas
How to add Multiply any number with index of array in node.js using hbs engine?
{{#each myArray}}
<div class="product-default-single-item product-color--golden" data-aos="fade-up" data-aos-delay="{{@index * 200}}">
</div>
{{/each}}

This is my code . I want a dynamic delay to all contents which added dynamically. For example if i add another product in mongodb then i want to multiply his index to 200. @index is working fine . I'm getting @index but Multiply() or Add(+) is not working. when i add multiply() or add (+). It give me error.

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

0

Here is the answer from my point of view. First you need to create a custom helper here is the code example

hbs.registerHelper("multiple",function(index,value){
    return index * value;
}


{{#each myArray}}
    <div class="product-default-single-item product-color--golden" data-aos="fade-up" data-aos-delay="{{#multiple @index 200}}{{/multiple}}">
    </div>
{{/each}}
//Let the myArray length is 2
// The output will be 0 and 200
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