【问题标题】:Bind edited JSON in <pre> tag to the variable将 <pre> 标记中已编辑的 JSON 绑定到变量
【发布时间】:2018-07-15 08:01:12
【问题描述】:

我使用 json 管道在 pre 标记中显示 JSON。不幸的是,当我编辑 JSON 时,我看不到 value 变量的变化,那么如何绑定这些值?

<pre contenteditable="true">{{value | json}}</pre>

【问题讨论】:

标签: html angular typescript


【解决方案1】:

我用&lt;textarea&gt; 代替&lt;pre&gt; 解决了我的问题:)

【讨论】:

    【解决方案2】:

    也许你尝试过类似的方法:

    <input type="text" col="5" [(NgModel)]="value" />
    
    <pre contenteditable="true">{{value | json}}</pre>
    

    所以将你的 json 放在一个文本区域中并绑定你的值?

    希望对你有帮助!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-30
      • 1970-01-01
      • 2014-07-06
      • 2011-03-09
      • 1970-01-01
      • 2012-01-12
      • 1970-01-01
      相关资源
      最近更新 更多