angular-schema-form
angular-schema-form copied to clipboard
Default value for an 'array' type
Enhancement
As a user/developer, when I set a default value for an 'array' type schema then the array should be populated with those values to begin with, just like with other types ('string', 'number', etc)
Actual behaviour
value of the 'default' key is ignored for arrays further if I set the 'startEmpty' option to true, then the array defaults are in fact used but they render all wonky (model is fine, but the rendered form elements are empty until you click on them)
@json-schema-form/angular-schema-form-lead
@mnzaki can you make an example gist for me to test against?
I made a gist and when I set to startEmpty it worked as intended, I suspect it may be a combination of values causing the display issues and I'd love to know what your form/schema combo contained. http://localhost/asf/examples/example.html#/daee70e7734f16229073d7d122cdff67
I also can't get the defaults to work on my development machine. On the example page here, when I add defaults for arrays they work fine, http://schemaform.io/examples/bootstrap-example.html. In my current project I'm using the following in my bower.json and the defaults for arrays don't seem to work. Could this be because of the fact that its an alpha version of schema-form I'm using?
"angular-schema-form": "v1.0.0-alpha.2",
"angular-schema-form-bootstrap": "latest"
I tried using the alpha of bootstrap also but can't seem to get bower to take it down for me, its always saying the latest is 0.2.0.
@mark007 I haven't pushed the alpha for bootstrap yet, I will try to get a version of the alpha out for bootstrap if I can this weekend, but it isn't as high a priority as getting features into a state where they can be tested at least in the bundled version in the ASF repo. It will be more of a priority when I hit beta, but I will still try to get something in bower soon.
Same problem in alpha 4
Thanks @MGouaillier
Seems the default will only get set if the default value is in the schema and not the form definition, but also not on load only on new item.