Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
¿Cómo agregar Multiplicar cualquier número con índice de matriz en node.js usando el motor hbs?
{{#each myArray}} <div class="product-default-single-item product-color--golden" data-aos="fade-up" data-aos-delay="{{@index * 200}}"> </div> {{/each}}

Este es mi código. Quiero un retraso dinámico para todos los contenidos que se agregaron dinámicamente. Por ejemplo, si agrego otro producto en mongodb, entonces quiero multiplicar su índice a 200. @index funciona bien. Obtengo @index pero Multiply( ) o Add(+) no funcionan. cuando sumo multiplica( ) o sumo (+). Me da error.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Aquí está la respuesta desde mi punto de vista. Primero necesita crear un ayudante personalizado aquí está el ejemplo de código

 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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!