WP-API和HTML标记

时间:2016-01-18 13:26:50

标签: html angularjs wordpress wp-api

我使用WP-API从外部网站提取数据并使用AngularJS显示它 - http://dev.5874.co.uk/goshooting/search-the-shooting-club-directory/

数据正在好转,但是它显示了HTML标签,例如

我该怎么办?我也在使用可能有所贡献的高级自定义字段。

<div  ng-controller="northWestCtrl">
              <div ng-repeat="d in data">
                <h2 class="entry-title title-post">{{d.title}}</h2>
                <img src="{{d.acf.logo}}">
                <div id="listing-contact">Contact: {{d.acf.contact}}, {{d.acf.position}}</div>
                <div id="listing-address-1">
                  {{d.acf.address_1}}, {{d.acf.address_2}} {{d.acf.address_3}} {{d.acf.town}} {{d.acf.county}} {{d.acf.postcode}}
                </div>
                <div id="listing-phone">Telephone: {{d.acf.telephone}}</div>
                <div id="listing-mobile">Mobile: {{d.acf.mobile}}</div>
                <div id="listing-email">Email: {{d.acf.email}}</div>
                <div id="listing-website">Website: <a href="{{d.acf.website}}">{{d.acf.website}}</a></div>
                <div id="listing-established">Established: {{d.acf.established}}</div>
                <div id="listing-about">About: {{d.acf.about}}</div>
                <div id="listing-mailingaddress">Mailing Address: {{d.acf.mailing_address_}}, {{d.acf.mailing_address_2}}, {{d.acf.mailing_address_3}}, {{d.acf.mailing_town}}, {{d.acf.mailing_county}}, {{d.acf.mailing_postcode}}</div>
                <div id="listing-directions">Directions: {{d.acf.directions}}</div>
                <div id="scd-link"><a href="{{d.link}}">View on The Shooting Club Directory</a></div>
              </div>
            </div>
          </div>

这是一个有效的代码笔 - http://codepen.io/anon/pen/yePYdq

非常感谢任何帮助,谢谢!

1 个答案:

答案 0 :(得分:0)

如果我理解你,请使用此网站通过API

获取数据http://scd.blaze.wpengine.com/wp-json/posts?type=listings&filter[listing_area]=northeast

您的控制台也显示错误

[Error] XMLHttpRequest cannot load http://scd.blaze.wpengine.com/wp-json/posts?type=listings&filter[listing_area]=northeast. Origin http://dev.5874.co.uk is not allowed by Access-Control-Allow-Origin.

也许此链接会有所帮助Origin is not allowed