jsonEditorCtrl.js 459 B

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