[英]ngb popover not rendering html encoding
我需要在 ngbPopover 中渲染一些文本,我可以做到。
这里的问题是我需要在文本之间换行。
我尝试使用 <br>, \\n, \ nothings 对我有用 <br> 按原样显示,对于 \\n 和 \ 我在屏幕上看不到任何影响。
以下是我的代码供参考。
html
<ng-template #subCoveragePopup>
<div class="sub-coverage-tooltip">
<div class="details">
<div *ngFor="let subCov of getSubCoverageDescription(quoteCoverage.coverage)">
<div class="title">{{subCov.code}}</div>
<div class="">{{subCov.name}}</div>
</div>
</div>
</div>
</ng-template>
在subCov.name
我通过 angular 得到以下文本 ->
测试:这是第 1 行\ 这是第 2 行
要么
测试:这是第 2 行 \\n 这是第 2 行
要么
测试:这是第 <BR> 这是第 2 行
使用所有三个选项,我无法显示换行符。 有什么我想念的吗?
将 css 样式添加到同一个 div :
<ng-template #subCoveragePopup>
<div class="sub-coverage-tooltip">
<div class="details">
<div *ngFor="let subCov of getSubCoverageDescription(quoteCoverage.coverage)">
<div class="title">{{subCov.code}}</div>
<div class="splitLine">{{subCov.name}}</div>
</div>
</div>
</div>
</ng-template>
.splitLine {
style="white-space: pre;"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.