Open donalmurtagh opened 7 years ago
Thanks @donalmurtagh I will be able to make a test out of this to avoid it happening again once fixed, there's so many scenarios that don't have tests still, good to have someone using the framework in a way I don't, I appreciate you taking the time to report them :)
I checked in an old version and the same behaviour exists, the only supported version of titleMap within x-schema-form is an object list like the below:
titleMap: {
{ "value": "married", "name": "Married" },
{ "value": "single", "name": "Single / separated / divorced / widow(er)" },
{ "value": "cohabitating", "name": "Living with a partner" }
}
I can certainly see why it would help if this had of been documented!
It was before my time so the best I can offer is to update the documentation to indicate the requirement for now and keep this issue as an enhancement. I would accept a PR on it, but I can't see myself having the time to fix it given how little time I have unfortunately.
the best I can offer is to update the documentation to indicate the requirement for now and keep this issue as an enhancement
that seems like a reasonable interim measure
@Anthropic I can confirm that the following successfully works around this issue
'x-schema-form': {
titleMap: [
{value: 'married', name: 'Married'},
{value: 'single', name: 'Single / separated / divorced / widow(er)'},
{value: 'cohabitating', name: 'Living with a partner'}
]
}
Notice that in your code snippet, you proposed assigning an object rather than an array to titleMap
, which doesn't work
Oh sorry, my being lazy I just copied your one from above and altered it to objects for each option and didn't alter the parent brackets :)
Steps to reproduce
x-schema-form
attributes are removed from the schema and moved to the form definition, it works. In other words, you can workaround the issue by changing the schema to:and changing the form definition to:
The Plunker demo is using the latest code from the dev branches of angular-schema-form and angular-schema-form-bootstrap.
@json-schema-form/angular-schema-form-lead