Skip to content

Commit 9f6287c

Browse files
committed
Merge pull request #7 from sochka/master
v0.1.3: Fix on-change callback undefined argument
2 parents a21da26 + cbd9df9 commit 9f6287c

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-json-editor",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"authors": [
55
"Rodik Hanukaev <[email protected]>",
66
"Topaz Bar <[email protected]>"

demo/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ angular.module('demoApp', ['angular-json-editor']).config(function (JsonEditorCo
3030
age: 20
3131
};
3232

33-
$scope.onChange = function () {
33+
$scope.onChange = function (data) {
3434
console.log('Form changed!');
35+
console.dir(data);
3536
};
3637

3738
}).controller('AsyncAppController', function ($scope, $http, $timeout) {

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<h2>Synchronous values</h2>
1414
<div class="container" ng-controller="SyncAppController">
15-
<json-editor schema="mySchema" startval="myStartVal" buttons-controller="SyncButtonsController" on-change="onChange()">
15+
<json-editor schema="mySchema" startval="myStartVal" buttons-controller="SyncButtonsController" on-change="onChange($editorValue)">
1616

1717
<button type="submit" class="btn btn-success" ng-click="onSubmit($event)" ng-disabled="!isValid">
1818
<span class="glyphicon glyphicon-check"></span>

dist/angular-json-editor.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-json-editor",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"repository": {
55
"type": "git",
66
"url": "git://github.com/rodikh/angular-json-editor.git"

src/angular-json-editor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ angular.module('angular-json-editor', []).constant('JsonEditorConfig', {
8484
editor.on('change', function () {
8585
// Fire the onChange callback
8686
if (typeof scope.onChange === 'function') {
87-
scope.onChange(editor.getValue());
87+
scope.onChange({
88+
$editorValue: editor.getValue()
89+
});
8890
}
8991
scope.$apply(function () {
9092
scope.isValid = (editor.validate().length === 0);

0 commit comments

Comments
 (0)