@@ -47,7 +47,6 @@ angular.module('schemaForm').provider('schemaForm',['sfPathProvider', function(s
47
47
if ( schema . title ) f . title = schema . title ;
48
48
if ( schema . description ) f . description = schema . description ;
49
49
if ( options . required === true || schema . required === true ) f . required = true ;
50
- if ( schema . default !== undefined ) f . default = schema . default ;
51
50
if ( schema . maxLength ) f . maxlength = schema . maxLength ;
52
51
if ( schema . minLength ) f . minlength = schema . maxLength ;
53
52
if ( schema . readOnly || schema . readonly ) f . readonly = schema . readOnly || schema . readonly ;
@@ -303,23 +302,29 @@ angular.module('schemaForm').provider('schemaForm',['sfPathProvider', function(s
303
302
304
303
//if its has tabs, merge them also!
305
304
if ( obj . tabs ) {
306
- angular . forEach ( obj . tabs , function ( tab ) {
307
- tab . items = service . merge ( schema , tab . items , ignore ) ;
305
+ angular . forEach ( obj . tabs , function ( tab ) {
306
+ tab . items = service . merge ( schema , tab . items , ignore ) ;
308
307
} ) ;
309
308
}
310
309
311
310
//extend with std form from schema.
312
311
if ( obj . key ) {
313
- if ( typeof obj . key == 'string' ) {
312
+ if ( typeof obj . key = == 'string' ) {
314
313
obj . key = sfPathProvider . parse ( obj . key ) ;
315
314
}
316
315
317
316
var str = sfPathProvider . stringify ( obj . key ) ;
318
- if ( lookup [ str ] ) {
319
- return angular . extend ( lookup [ str ] , obj ) ;
317
+ if ( lookup [ str ] ) {
318
+ obj = angular . extend ( lookup [ str ] , obj ) ;
320
319
}
321
320
}
322
321
322
+ // Special case: checkbox
323
+ // Since have to ternary state we need a default
324
+ if ( obj . type === 'checkbox' && angular . isUndefined ( obj . schema [ 'default' ] ) ) {
325
+ obj . schema [ 'default' ] = false ;
326
+ }
327
+
323
328
return obj ;
324
329
} ) ) ;
325
330
} ;
0 commit comments