【问题标题】:how to make the editor text to get the data same as json data using angular2 or typescript如何使用 angular2 或 typescript 使编辑器文本获取与 json 数据相同的数据
【发布时间】:2017-11-02 11:03:14
【问题描述】:

我有一个 json 数据,但是当它被分配给编辑器时,它缺少引号,所以任何人都可以帮助我如何将引号也提供给编辑器。

ts 代码:

this.product
      .getproduct(t)
      .subscribe(
        products => {
          let editorOptions = {
            showJSONEditorTab: true
          };
        }),

  }

我在这里得到了这样的 console.log(this.survey_val) 输出:

{"pages":[{"name":"page1"]} 

console.log(this.editor.text);

   {
 pages: [
  {
   name: "page1",
     ]
    }

【问题讨论】:

    标签: javascript json angular typescript


    【解决方案1】:

    我通过付出得到了它,

    let editorOptions = {
                showJSONEditorTab: true, generateValidJSON : true
              };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-28
      • 1970-01-01
      • 1970-01-01
      • 2017-12-13
      • 2013-10-03
      • 2021-08-11
      相关资源
      最近更新 更多