在WordPress REST API中具有
之类的值 "content": {
"rendered": "<div class="pro-info">n<p>Villes & Paysages, an Egis Group subsidiary, is an urban planning and design agency for public spaces. Their approach is based on the creation of favorable conditions for the expression of bodies in motion: to create an urban composition capable of transcending technical standards, management of flows, integration of infrastructures, economic dynamics … Villes & Paysages asked us to rethink their visual identity as well as their website.</p>n<p><img src="http://dev.twinsway.com/ty001/wp-content/uploads/2017/08/pr2-6.jpg" alt="" /></p>n</div>n<p><iframe width="560" height="315" src="https://www.youtube.com/embed/rHmk0UhJSb4" frameborder="0" allowfullscreen></iframe></p>n"
我的角度代码就像
<div class="container">
<div [innerHTML]="singleDetails.content.rendered"> </div>
</div>
所有其他DIV都可以正常工作。但是iframe在Angular2中不起作用。请帮我。预先感谢
您是否尝试过此
<div class="container">
<div [innerHTML]="singleDetails?.content?.rendered"> </div>
</div>
还尝试在HTML中尝试打印以确保数据是否在查看部分中
{{singleDetails?.content?.rendered}}