【问题标题】:METEOR JS. A variable in each loop流星JS。每个循环中的一个变量
【发布时间】:2016-11-06 18:53:09
【问题描述】:

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,
            }]
        }
})

一切正常,但我似乎无法在“each”循环中找到“descrip.idForm”的值。

谁能告诉我为什么,在循环“each”中,“descrip.idForm”是空的,那么循环外就等于“formContact”

感谢您的回答

YC

【问题讨论】:

标签: javascript meteor


【解决方案1】:

您能否删除 FORMULAIRE 模板调用中 descript 和 = 之间的空格。

Regs,yann

【讨论】:

    猜你喜欢
    • 2015-06-06
    • 1970-01-01
    • 2015-11-13
    • 2018-10-13
    • 1970-01-01
    • 2011-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多