首页 > 解决方案 > 我想将 WordPress 网站上的广告集成到我的 ionic 应用程序中,我该怎么做?

问题描述

我正在使用 WordPress API 构建一个离子应用程序,但我不知道如何在我的应用程序上显示广告

这是我的 html 文件。

<ion-content>
<div class="item-profile" text-center #profilePic [style.background- 
 image]="'url(' + item?.jetpack_featured_media_url + ')'">
  </div>
  <div class="item-detail" padding style=" z-index: 1119">
  <h1  [innerHTML]="item?.title.rendered"></h1>
  <h6>{{item?.date}}</h6>
  </div>  

    <div class="item-detail" padding>
    <span [innerHTML]="item?.content.rendered"></span>
    </div>
    </ion-content>

这是 .ts 文件

    export class ItemDetailPage {
    item: any;
    getData:any;

    constructor(public navCtrl: NavController,public api:Api, 
    navParams: NavParams, items: Items,public http: HttpClient) {
    var temp = navParams.get('itemName') || items.defaultItem;
     console.log(temp)
     this.getPOst(temp.id)
      }

      getPOst(id){
        this.api.get1('wp-json/wp/v2/posts/' + id).subscribe(data=>{
       console.log(data)
        this.item = data
        })
         }

标签: ionic3

解决方案


推荐阅读