jsonEditorCtrl.js 429 B

1234567891011121314151617181920
  1. define([
  2. 'angular',
  3. '../core_module',
  4. ],
  5. function (angular, coreModule) {
  6. 'use strict';
  7. coreModule.controller('JsonEditorCtrl', function($scope) {
  8. $scope.json = angular.toJson($scope.object, true);
  9. $scope.canUpdate = $scope.updateHandler !== void 0;
  10. $scope.update = function () {
  11. var newObject = angular.fromJson($scope.json);
  12. $scope.updateHandler(newObject, $scope.object);
  13. };
  14. });
  15. });