【发布时间】:2014-11-24 10:21:45
【问题描述】:
我有一个包含对象数组的 SimpleSchema:
Things.attachSchema( new SimpleSchema({
name: {
type: String,
label: "Name",
max: 50
},
fields: {
type: [Object],
},
fields.$.name: {
type: String
},
fields.$.amount: {
type: Number
}
}) )
我正在尝试使用 afEachArrayItem 创建自定义表单,但我不知道如何引用数组中每个对象的属性。
我的模板看起来像这样(去掉了 html):
{{#autoForm collection="things" id="myForm" }}
{{> afQuickField name='schemaName'}}
{{#afEachArrayItem name="fields"}}
{{> afFieldInput name="name"}
{{> afFieldInput name="amount"}
{{/afEachArrayItem}}
{{/autoForm}}
在 afFieldInputs 中应该将什么传递给“name”?
【问题讨论】: