如何从innerHtml中删除逗号,值来自angular 4中的JSON?附图

如何从innerHtml中删除逗号,值来自angular 4中的JSON?附图,angular,Angular,JSON响应: { "qno": 1, "question": "What is HTML5? And, what are the new features?", "answer": [ "<p>HTML is a markup language designed for processing, defining, presenting and formatting the tex

JSON响应:

{
            "qno": 1,
            "question": "What is HTML5? And, what are the new features?",
            "answer": [
                "<p>HTML is a markup language designed for processing, defining, presenting and formatting the text. The HTML5 is the latest version and has features like:</p>",
            "<ul class=\"none\"><li>Local Storage</li>",
            "<li>New form elements like date, time, url, range, color</li>",
            "<li>Canvas for 2D drawing</li>",
            "<li>Media elements like audio and video</li>",
            "<li>New semantic elements like, <code>nav</code>, <code>header</code>, <code>footer</code>, <code>section</code> and <code>article</code></li>",
            "<li>Local storage and Session storage instead of cookies.</li></ul>"
            ]
}
使用innerHTML 4绑定答案

你喜欢这样吗

 htmlData.questions.forEach(data = > data.answer.replace(/<\/li>\",/g, '</li>');
htmlData.questions.forEach(数据=>data.answer.replace(/\”,/g,“”);

检索对象中的数据后替换字符串。

请共享尝试的代码。

ngforHTMLDATAS.answer to绑定值时,在行尾还打印逗号..例如:”
  • 本地存储“,“
  • 新表单元素,如日期、时间、url、范围、颜色”
  • ,“
  • 二维绘图画布”,“
  • 媒体元素,如音频和视频”
  • ”,这对你有用吗?通过使用join()工作正常…谢谢

    @Mohan-如果答案对你有帮助,请接受投票