Get label for AutoForm option value in Meteor Simple Schema -
in meteor template {{parameter}}
returns value of option schema:
new simpleschema({ parameter: { type: string, allowedvalues: ['value_1', 'value_2'], autoform: { options: [ {label: "label_1", value: 'value_1'}, {label: "label_2", value: 'value_2'} ] } }, });
how can label
instead of value
in template?
template.yourtemplate.helpers({ label: function (value) { return _.findwhere(yourschema.schema('parameter').autoform.options, { value: value }).label; } });
Comments
Post a Comment