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

199
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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!