@@ -17,12 +17,18 @@ angular.module('schemaForm').provider('schemaForm',
1717
1818 // Takes a titleMap in either object or list format and returns one in
1919 // in the list format.
20- var canonicalTitleMap = function ( titleMap ) {
20+ var canonicalTitleMap = function ( titleMap , originalEnum ) {
2121 if ( ! angular . isArray ( titleMap ) ) {
2222 var canonical = [ ] ;
23- angular . forEach ( titleMap , function ( name , value ) {
24- canonical . push ( { name : name , value : value } ) ;
25- } ) ;
23+ if ( originalEnum ) {
24+ angular . forEach ( originalEnum , function ( value , index ) {
25+ canonical . push ( { name : titleMap [ value ] , value : value } ) ;
26+ } ) ;
27+ } else {
28+ angular . forEach ( titleMap , function ( name , value ) {
29+ canonical . push ( { name : name , value : value } ) ;
30+ } ) ;
31+ }
2632 return canonical ;
2733 }
2834 return titleMap ;
@@ -63,7 +69,7 @@ angular.module('schemaForm').provider('schemaForm',
6369
6470 //Non standard attributes
6571 if ( schema . validationMessage ) { f . validationMessage = schema . validationMessage ; }
66- if ( schema . enumNames ) { f . titleMap = canonicalTitleMap ( schema . enumNames ) ; }
72+ if ( schema . enumNames ) { f . titleMap = canonicalTitleMap ( schema . enumNames , schema . enum ) ; }
6773 f . schema = schema ;
6874
6975 // Ng model options doesn't play nice with undefined, might be defined
0 commit comments