File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,15 @@ angular.module('schemaForm').provider('schemaForm',
40
40
var def ;
41
41
for ( var i = 0 ; i < rules . length ; i ++ ) {
42
42
def = rules [ i ] ( name , schema , options ) ;
43
+
43
44
//first handler in list that actually returns something is our handler!
44
45
if ( def ) {
46
+
47
+ // Do we have form defaults in the schema under the x-schema-form-attribute?
48
+ if ( def . schema [ 'x-schema-form' ] && angular . isObject ( def . schema [ 'x-schema-form' ] ) ) {
49
+ def = angular . extend ( def , def . schema [ 'x-schema-form' ] ) ;
50
+ }
51
+
45
52
return def ;
46
53
}
47
54
}
@@ -67,14 +74,16 @@ angular.module('schemaForm').provider('schemaForm',
67
74
if ( schema . minimum ) { f . minimum = schema . minimum + ( schema . exclusiveMinimum ? 1 : 0 ) ; }
68
75
if ( schema . maximum ) { f . maximum = schema . maximum - ( schema . exclusiveMaximum ? 1 : 0 ) ; }
69
76
70
- //Non standard attributes
77
+ // Non standard attributes (DONT USE DEPRECATED)
78
+ // If you must set stuff like this in the schema use the x-schema-form attribute
71
79
if ( schema . validationMessage ) { f . validationMessage = schema . validationMessage ; }
72
80
if ( schema . enumNames ) { f . titleMap = canonicalTitleMap ( schema . enumNames , schema [ 'enum' ] ) ; }
73
81
f . schema = schema ;
74
82
75
83
// Ng model options doesn't play nice with undefined, might be defined
76
84
// globally though
77
85
f . ngModelOptions = f . ngModelOptions || { } ;
86
+
78
87
return f ;
79
88
} ;
80
89
You can’t perform that action at this time.
0 commit comments