@@ -47,7 +47,6 @@ angular.module('schemaForm').provider('schemaForm',['sfPathProvider', function(s
4747 if ( schema . title ) f . title = schema . title ;
4848 if ( schema . description ) f . description = schema . description ;
4949 if ( options . required === true || schema . required === true ) f . required = true ;
50- if ( schema . default !== undefined ) f . default = schema . default ;
5150 if ( schema . maxLength ) f . maxlength = schema . maxLength ;
5251 if ( schema . minLength ) f . minlength = schema . maxLength ;
5352 if ( schema . readOnly || schema . readonly ) f . readonly = schema . readOnly || schema . readonly ;
@@ -303,23 +302,29 @@ angular.module('schemaForm').provider('schemaForm',['sfPathProvider', function(s
303302
304303 //if its has tabs, merge them also!
305304 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 ) ;
308307 } ) ;
309308 }
310309
311310 //extend with std form from schema.
312311 if ( obj . key ) {
313- if ( typeof obj . key == 'string' ) {
312+ if ( typeof obj . key = == 'string' ) {
314313 obj . key = sfPathProvider . parse ( obj . key ) ;
315314 }
316315
317316 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 ) ;
320319 }
321320 }
322321
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+
323328 return obj ;
324329 } ) ) ;
325330 } ;
0 commit comments