diff --git a/dist/angular-json-editor.js b/dist/angular-json-editor.js index 0eb6986..1c46a29 100644 --- a/dist/angular-json-editor.js +++ b/dist/angular-json-editor.js @@ -143,7 +143,7 @@ angular.module('angular-json-editor', []).provider('JSONEditor', function () { newVal.then(function (data) { if (data.data) { schema = data.data; - }else { + } else { schema = data; } restart(); @@ -156,7 +156,9 @@ angular.module('angular-json-editor', []).provider('JSONEditor', function () { return clone; }); - element.append(buttons); + transclude(scope, function (buttons) { + element.append(buttons); + }); }); } }; diff --git a/dist/angular-json-editor.min.js b/dist/angular-json-editor.min.js index 3a5adc7..f07c361 100644 --- a/dist/angular-json-editor.min.js +++ b/dist/angular-json-editor.min.js @@ -1,2 +1,2 @@ // angular-json-editor v0.3.0 -!function(a,b){"use strict";b.module("angular-json-editor",[]).provider("JSONEditor",function(){function a(c){return b.forEach(arguments,function(d){d!==c&&b.forEach(d,function(b,d){c[d]&&c[d].constructor&&c[d].constructor===Object?a(c[d],b):c[d]=b})}),c}var c={defaults:{options:{iconlib:"bootstrap3",theme:"bootstrap3"}}};this.configure=function(b){a(c,b)},this.$get=["$window",function(b){return a(b.JSONEditor,c),b.JSONEditor}]}).directive("jsonEditor",["$q","JSONEditor",function(a,c){return{restrict:"E",transclude:!0,scope:{schema:"=",startval:"=",buttonsController:"@",onChange:"&"},controller:["$scope","$attrs","$controller",function(a,c,d){var e,f,g=c.buttonsController;if(b.isString(g)&&""!==g){f={$scope:a};try{e=d(g,f)}catch(a){throw new Error("angular-json-editor: buttons-controller attribute must be a valid controller.")}}}],link:function(d,e,f,g,h){var i=a.when(d.startval),j=a.when(d.schema);if(d.isValid=!1,!b.isString(f.schema))throw new Error("angular-json-editor: schema attribute has to be defined.");a.all([j,i]).then(function(b){function f(){var a=k;d.editor&&d.editor.destroy&&(a=d.editor.getValue(),d.editor.destroy()),d.editor=new c(e[0],{startval:a,schema:j},!0),d.editor.on("ready",g),d.editor.on("change",i),e.append(l)}function g(){d.isValid=0===d.editor.validate().length}function i(){"function"==typeof d.onChange&&d.onChange({$editorValue:d.editor.getValue()}),d.$apply(function(){d.isValid=0===d.editor.validate().length})}var j=b[0].data||b[0],k=b[1].data||b[1];if(null===j)throw new Error("angular-json-editor: could not resolve schema data.");f(),d.$watch("schema",function(a){a.then?a.then(function(a){j=a,f()}):(j=a,f())},!0),d.$watchCollection("schema",function(b){b instanceof a&&b.then(function(a){j=a.data?a.data:a,f()})});var l=h(d,function(a){return a});e.append(l)})}}}])}(window,angular); \ No newline at end of file +!function(a,b){"use strict";b.module("angular-json-editor",[]).provider("JSONEditor",function(){function a(c){return b.forEach(arguments,function(d){d!==c&&b.forEach(d,function(b,d){c[d]&&c[d].constructor&&c[d].constructor===Object?a(c[d],b):c[d]=b})}),c}var c={defaults:{options:{iconlib:"bootstrap3",theme:"bootstrap3"}}};this.configure=function(b){a(c,b)},this.$get=["$window",function(b){return a(b.JSONEditor,c),b.JSONEditor}]}).directive("jsonEditor",["$q","JSONEditor",function(a,c){return{restrict:"E",transclude:!0,scope:{schema:"=",startval:"=",buttonsController:"@",onChange:"&"},controller:["$scope","$attrs","$controller",function(a,c,d){var e,f,g=c.buttonsController;if(b.isString(g)&&""!==g){f={$scope:a};try{e=d(g,f)}catch(a){throw new Error("angular-json-editor: buttons-controller attribute must be a valid controller.")}}}],link:function(d,e,f,g,h){var i=a.when(d.startval),j=a.when(d.schema);if(d.isValid=!1,!b.isString(f.schema))throw new Error("angular-json-editor: schema attribute has to be defined.");a.all([j,i]).then(function(b){function f(){var a=k;d.editor&&d.editor.destroy&&(a=d.editor.getValue(),d.editor.destroy()),d.editor=new c(e[0],{startval:a,schema:j},!0),d.editor.on("ready",g),d.editor.on("change",i),e.append(l)}function g(){d.isValid=0===d.editor.validate().length}function i(){"function"==typeof d.onChange&&d.onChange({$editorValue:d.editor.getValue()}),d.$apply(function(){d.isValid=0===d.editor.validate().length})}var j=b[0].data||b[0],k=b[1].data||b[1];if(null===j)throw new Error("angular-json-editor: could not resolve schema data.");f(),d.$watch("schema",function(a){a.then?a.then(function(a){j=a,f()}):(j=a,f())},!0),d.$watchCollection("schema",function(b){b instanceof a&&b.then(function(a){j=a.data?a.data:a,f()})});var l=h(d,function(a){return a});h(d,function(a){e.append(a)})})}}}])}(window,angular); \ No newline at end of file diff --git a/src/angular-json-editor.js b/src/angular-json-editor.js index 75ef2b4..dbeeafb 100644 --- a/src/angular-json-editor.js +++ b/src/angular-json-editor.js @@ -140,7 +140,7 @@ angular.module('angular-json-editor', []).provider('JSONEditor', function () { newVal.then(function (data) { if (data.data) { schema = data.data; - }else { + } else { schema = data; } restart(); @@ -152,8 +152,8 @@ angular.module('angular-json-editor', []).provider('JSONEditor', function () { var buttons = transclude(scope, function (clone) { return clone; }); - - transclude(scope, function (buttons) { + + transclude(scope, function (buttons) { element.append(buttons); }); });