【发布时间】:2016-09-21 14:14:51
【问题描述】:
在带有 AutoForm + Select2 插件的 Meteor 中使用 SimpleSchema,我正在尝试从数据库中为 Select 字段生成选项。
发布'occupation'集合,并在Meteor中定义一个集合'Occupation'。
在 SimpleSchema 中我有这个:-
occupations: {
type: [String],
optional:true,
label: 'Occupation',
autoform:{
type:"select2",
placeholder: 'Comma spaced list of occupations',
options: function () {
Meteor.subscribe('occupations');
return Occupations.find({});
}
}
},
但它不返回收集结果,并在没有错误消息的情况下使应用程序崩溃。
【问题讨论】:
标签: meteor meteor-autoform select2 simple-schema