Skip to content

Commit 19a142a

Browse files
committed
sf-field: fix form key edge case
1 parent f22e961 commit 19a142a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/directives/sf-field.directive.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ sfPath, sfSelect) {
4646
if(scope.completeKey !== scope.form.key) {
4747
if (typeof scope.$index === 'number') {
4848
key = key.concat(scope.$index);
49-
};
49+
}
5050

5151
if(scope.form.key && scope.form.key.length) {
5252
if(typeof key[key.length-1] === 'number' && scope.form.key.length >= 1) {
5353
let trim = scope.form.key.length - key.length;
54-
scope.completeKey = key.concat(scope.form.key.slice(-trim));
55-
}
56-
else {
54+
scope.completeKey =
55+
trim > 0 ? key.concat(scope.form.key.slice(-trim)) : key;
56+
} else {
5757
scope.completeKey = scope.form.key.slice();
58-
};
59-
};
60-
};
58+
}
59+
}
60+
}
6161

6262
// If there is no key then there's nothing to return
6363
if(!Array.isArray(scope.completeKey)) {

0 commit comments

Comments
 (0)