@@ -69,8 +69,7 @@ angular.module('angular-json-editor', []).provider('JSONEditor', function () {
6969 }
7070 } ] ,
7171 link : function ( scope , element , attrs , controller , transclude ) {
72- var valueToResolve ,
73- startValPromise = $q . when ( { } ) ,
72+ var startValPromise = $q . when ( { } ) ,
7473 schemaPromise = $q . when ( null ) ;
7574
7675 scope . isValid = false ;
@@ -83,21 +82,15 @@ angular.module('angular-json-editor', []).provider('JSONEditor', function () {
8382 }
8483 if ( angular . isObject ( scope . startval ) ) {
8584 // Support both $http (i.e. $q) and $resource promises, and also normal object.
86- valueToResolve = scope . startval ;
87- if ( angular . isDefined ( valueToResolve . $promise ) ) {
88- startValPromise = $q . when ( valueToResolve . $promise ) ;
89-
90- } else {
91- startValPromise = $q . when ( valueToResolve ) ;
92- }
85+ startValPromise = $q . when ( scope . startval ) ;
9386 }
9487
9588 // Wait for the start value and schema to resolve before building the editor.
9689 $q . all ( [ schemaPromise , startValPromise ] ) . then ( function ( result ) {
9790
9891 // Support $http promise response with the 'data' property.
9992 var schema = result [ 0 ] . data || result [ 0 ] ,
100- startVal = result [ 1 ] ;
93+ startVal = result [ 1 ] . data || result [ 1 ] ;
10194 if ( schema === null ) {
10295 throw new Error ( 'angular-json-editor: could not resolve schema data.' ) ;
10396 }
0 commit comments