【发布时间】:2017-01-16 19:59:48
【问题描述】:
我有来自 JSON 的文本,看起来像这样:
"some text some text some text \n\n New paragraph text \n\n Another new paragraph"
然后我有一个简单的 div,如下所示:
<div ng-bind="textFromJSON"></div>
由于某种原因,呈现到页面的文本结果没有换行符。即
some text some text some text New paragraph text Another new paragraph
如果我使用 chrome 开发工具检查该文本,它会显示使用 \n 换行符分成段落的文本块,就像我预期的那样。
some text some text some text
New paragraph text
Another new paragraph
有谁知道如何让页面正确呈现?
【问题讨论】:
标签: javascript html angularjs json line-breaks