Skip to content

Commit 0e3b0e1

Browse files
committed
Start arrays with an empty field
1 parent 6cc56cb commit 0e3b0e1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bootstrap-decorator.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function(decoratorsProvider, sfBuilderProvider, sfPathProvider) {
8080

8181
}])
8282

83-
/* Directives here are WIP, will be moved to main repo or their own files when soldifying */
83+
/* Directives here are WIP, will be moved to main repo or their own files when solidifying */
8484
.directive('sfNewArray', ['sfSelect', 'sfPath', function(sel, sfPath) {
8585
return {
8686
scope: false,
@@ -117,6 +117,13 @@ function(decoratorsProvider, sfBuilderProvider, sfPathProvider) {
117117
if (!form) {
118118
return;
119119
}
120+
121+
// Always start with one empty form unless configured otherwise.
122+
// Special case: don't do it if form has a titleMap
123+
if (!form.titleMap && form.startEmpty !== true && (!scope.modelArray || scope.modelArray.length === 0)) {
124+
scope.appendToArray();
125+
}
126+
120127
// If we have "uniqueItems" set to true, we must deep watch for changes.
121128
if (scope.form && scope.form.schema && scope.form.schema.uniqueItems === true) {
122129
scope.$watch(attrs.sfNewArray, watchFn, true);

0 commit comments

Comments
 (0)