简体   繁体   中英

METEOR JS. A variable in each loop

HTML

 <template name="contact"> ... {{> FORMULAIRE descrip =descripFormContact }} ... </template> <template name="FORMULAIRE" > <form id={{descrip.idForm}} > <fieldset id="idFieldSet{{descrip.idForm}}"> {{#each descrip.champs}} <span id="idSpanLabel{{descrip.idForm}}" ....>{{this.label}}</span> ... {{/each}} </fieldset> </form> </template> 

JS

 Template.contact.helpers({ descripFormContact: { idForm: 'formContact', champs: [{ nomChp: 'prenom', label: 'Prenom : ', type: 'text', oblig:true, }] } }) 

All is OK but I can't seem to find the value of "descrip.idForm" in the loop "each".

Can someone tell me why, in the loop "each", "descrip.idForm" is empty, then that the outside of the loop is equal to "formContact"

Thank you for your answer

YC

Could you remove the space between descript and = in your FORMULAIRE template call.

Regs,yann

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM