Skip to content

Commit 5ada453

Browse files
committed
Merge pull request #253 from Anthropic/master
Fix for #247 copyValueTo for numeric types
2 parents 0e22d49 + 831c374 commit 5ada453

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

examples/data/sink.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "object",
44
"required": [
55
"name",
6-
"shoesize"
6+
"shoesizeLeft"
77
],
88
"properties": {
99
"name": {
@@ -28,8 +28,13 @@
2828
"NaN"
2929
]
3030
},
31-
"shoesize": {
32-
"title": "Shoe size",
31+
"shoesizeLeft": {
32+
"title": "Shoe size (left)",
33+
"default": 42,
34+
"type": "number"
35+
},
36+
"shoesizeRight": {
37+
"title": "Shoe size (right)",
3338
"default": 42,
3439
"type": "number"
3540
},
@@ -161,8 +166,12 @@
161166
"copyValueTo": ["attributes.shoulders.right"]
162167
},
163168
{
164-
"key": "shoesize",
165-
"feedback": false
169+
"key": "shoesizeLeft",
170+
"feedback": false,
171+
"copyValueTo":["shoesizeRight"]
172+
},
173+
{
174+
"key": "shoesizeRight"
166175
},
167176
{
168177
"key": "invitation",

src/directives/schema-validate.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', 'sfSele
2020
return form;
2121
};
2222
var form = getForm();
23-
2423
if (form.copyValueTo) {
2524
ngModel.$viewChangeListeners.push(function() {
2625
var paths = form.copyValueTo;
2726
angular.forEach(paths, function(path) {
28-
sfSelect(path, scope.model, ngModel.$viewValue);
27+
sfSelect(path, scope.model, ngModel.$modelValue);
2928
});
3029
});
3130
}

0 commit comments

Comments
 (0)