在渲染时使用 TextAngular 显示空 <p>

Display empty <p> with TextAngular at render

在使用 TextAngular 时,是否有一种简单的方法可以让空白 <p> 在所见即所得中可见?

如果字符串是<h1>test</h1><p></p><p></p><h2>subtitle</h2>,当页面渲染和内容传递给TextAngular时,HTML源代码有所有标签,但所见即所得没有显示它们。

我错过了什么吗? 谢谢

编辑:here is a fiddle to demonstrate

这不是一个优雅的解决方案,但您可以解析 html 字符串并将 &nbsp; 添加到您的空标签中。

this.html = "<h1>Test</h1><p>&nbsp;</p><p>&nbsp;</p><h2>Test</h2>";