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

254
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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