简体   繁体   English

使用ng-prettyjson的Json编辑模式

[英]Json Editing mode with ng-prettyjson

I would like to print json on part of my page. 我想在页面的一部分上打印json。 What is more I would like to offer possibility for editing displayed json. 另外,我想为编辑显示的json提供可能性。 I choose ng-prettyprint for those tasks. 我为那些任务选择ng-prettyprint

I execute all steps described in how-to-use-it section. 我执行如何使用部分中描述的所有步骤。 Unfortunatelly only visualization functionality is working well. 不幸的是,只有可视化功能运行良好。 On rendered page I do not see button for enabling edit mode, but json is visualized properly. 在渲染的页面上,我没有看到用于启用编辑模式的按钮,但是json可以正确显示。

My code snippets 我的代码段

Directive usage: 指令用法:

<pretty-json json="schema" edition="true"></pretty-json>

Inside controller I set value for json: 在控制器内部,我为json设置了值:

 $scope.schema = {
                   type: "record",
                   name: "test",
                   fields: [{
                      name: "test_field",
                      type: [
                        "double",
                         "null"
                      ]
                 }]};

Part of index.html for including ng-prettyjson sources index.html的一部分,用于包括ng-prettyjson源

    <head>
    ...
          <link rel="stylesheet" href="bower_components//ng-prettyjson/src/ng-prettyjson.css" />
    ...
    </head>
     ...
        <script src="bower_components/ng-prettyjson/src/ace.js"></script>
        <script src="bower_components/ng-prettyjson/src/ng-prettyjson.js"></script>
    ...

Where is the problem? 问题出在哪儿?

在(当前) ng-prettyprint (0.1.3)的最新发布版本(可用于bower )中,注释了负责生成按钮的指令代码的定义

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM