【问题标题】:iframe not working wp rest api json angular2iframe 不工作 wp rest api json angular2
【发布时间】:2017-09-06 06:41:39
【问题描述】:

在 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 中不起作用。 请帮我。 提前致谢

【问题讨论】:

  • 开发控制台中的任何错误?
  • 没有控制台错误

标签: json wordpress angular rest


【解决方案1】:

你试过了吗

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

也可以尝试在 HTML 中简单地打印,以确定数据是否像这样进入视图部分

{{singleDetails?.content?.rendered}}

【讨论】:

  • 您是否尝试过像我回答的第二个示例那样在 HTML 部分中打印?
  • @ShanaRaj 你能在 plunker 上重现你的问题吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-01-09
  • 2018-01-29
  • 1970-01-01
  • 2020-06-05
  • 1970-01-01
  • 1970-01-01
  • 2018-02-04
相关资源
最近更新 更多