I want to build a (section of a) form which produces the following output:
{
...
offers: {
context: "http://schema.org",
minPrice: 3
}
...
}
The catch is, context
should always be present - the only field the user gets to manipulate is minPrice
. Immediately, a hidden field with a value comes to mind. So here's the schema definition:
$scope.schema = {
...
offers: {
type: 'object',
properties: {
minPrice: {
type: 'number'
}
}
}
...
};
And here the form definition:
$scope.form = [
...
{
key: 'offers',
type: 'fieldset',
items: [
{
key: 'offers.minPrice',
type: 'number'
},
{
key: 'offers.context',
type: 'hidden',
default: 'http://schema.org'
}
]
}
...
];
However, observing the generated model it's obvious the entry context
is not present. I have successfully used a combination of type: 'hidden'
and default
with a tabarray
, but I just can't get it right with an object
. I am using version 0.8.13
of angular-schema-forms
- the latest at the time of this writing.
I'd appreciate any insights, thanks.