iframe没有工作wp rest api json angular2

时间:2017-09-06 06:41:40

标签: json wordpress angular rest

wordpress rest API中的

具有类似

的值
    "content": {
  "rendered": "<div class=\"pro-info\">\n<p>Villes &amp; 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 &#8230; Villes &amp; 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中工作。 请帮我。 提前谢谢

1 个答案:

答案 0 :(得分:0)

你试过这个吗?

<div class="container">
  <div [innerHTML]="singleDetails?.content?.rendered"> </div>
</div>

也可以尝试使用HTML进行简单打印,以确定数据是否来自视图部分,或者不是这样的

{{singleDetails?.content?.rendered}}