我有一个模式声明为:
JobSchema = new SimpleSchema({
responsibilities: {
type: [String],
optional: true
},
'responsibilities.$': {
min: 2,
autoform: {
afFieldInput: {
class: 'form-control'
},
placeholder: 'E.g. "Build tools according to specifications"'
}
}
});
我还有一个 UI 助手声明为:
Template.registerHelper('currentFieldValue', function (fieldName) {
return AutoForm.getFieldValue('insertJobForm', fieldName) || '';
});
我有一个模板,我使用这个助手来生成表单预览。它对除数组字段之外的所有字段都有效。什么都没有被渲染。有任何想法吗?
{{# if currentFieldValue "responsibilities"}}
<h3>Responsibilities</h3>
{{{currentFieldValue "responsibilities"}}}
{{/if}}