Business
Jobs
  • About Us
  • Solutions
    • Candidates
      Highly qualified candidates in 48h.
    • Assessments
      500+ technical and psychological assessments, plus anti-fraud system.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Pay in 15+ LATAM countries without setting up a local entity.
  • Pricing
  • Jobs

0

189
Views
En handlebars, cómo saber si estoy en la última aparición de la matriz principal

Estoy luchando con un pequeño problema mío en un proyecto de manillares. Estoy trabajando con un conjunto de matrices anidadas así:

 [ [ [ {Object: "Object1"}, {Object: "Object2"} ], [ {Object: "Object3"}, {Object: "Object4"} ] ], [ [ {Object: "Object5"}, {Object: "Object6"} ], [ {Object: "Object7"}, {Object: "Object8"} ] ], [ [ {Object: "Object5"}, {Object: "Object6"} ], [ {Object: "Object7"}, {Object: "Object8"} ] ] ]

Sé que puedo usar los booleanos @first y @last para saber si estoy en el último elemento de la matriz que se está iterando actualmente.

 {{#each foo}} <div class='{{#if @first}}first foo{{/if}} {{#if @last}} last foo{{/if}}'> {{@key}} - {{@index}} </div> {{/each}}

pero ¿qué pasa si quiero saber si estoy o no en el último elemento de una matriz principal ?

 {{#each fooParent}} {{#each foo}} <div class='{{#if @first}}first foo not fooparent{{/if}} {{#if @last}} last foo not fooparent{{/if}}'> <!-- How can I know here that I am on the last item of the fooParent array? --> {{@key}} - {{@index}} </div> {{/each}} {{/each}}

¿Alguien sabe cómo "regresar" a las matrices para saber, por ejemplo, si estoy en el último elemento de la matriz principal?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

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