假设我有这段文字:
$scope.text = 'This is the first line\nthis is the next line';
我想在 div 标签中使用 agularJs 来展示这一点
<div>{{text}}</div>
如何显示此文本的格式为 WITH 换行符? 现在它显示如下:
这是第一行这是下一行最佳答案
为清晰起见的内联样式
<div style="white-space: pre;">{{ text }}</div>
关于angularjs - 使用 CSS 显示带换行符的格式化 HTML 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31848983/