2

In Meteor template {{parameter}} returns value of option for this 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 I get label instead of value in my template?

A. Z.
  • 728
  • 1
  • 11
  • 28

1 Answers1

3
Template.yourTemplate.helpers({
  label: function (value) {
    return _.findWhere(YourSchema.schema('parameter').autoform.options, { value: value }).label;
  }
});
corvid
  • 10,733
  • 11
  • 61
  • 130