Closed
Description
I would like to implement the display of labels instead of values in radio boxes and would like to discuss about the best way to declare such labels in the forms-angular/mongoose model.
Currently a group of radio boxes can created with the following declaration:
myRadio: {
type: String,
enum: ['choice1', 'choice2'],
form: {
type: 'radio'
}
}
According to mongoose documentation and source code, the enum
property can be an object with a required 'values' entry. It seems we can add custom properties to this object.
Proposition:
myRadio: {
type: String,
enum: {
values: ['choice1', 'choice2'],
labels: ['Pizza', 'Lamb stew']
}
form: {
type: 'radio'
}
}