@elieobeid7 wrote:
I’m new to ionic/angular. I created a rest api for my custom theme taxonomy in wordpress. I created a provider called ads
retrieveAds() { return this.http.get(this.api_url) .map(res => res.json()); } retrieveThumbInAds(adId: number) { return this.http.get(this.thumb_url + adId ) .map(res => res.json()); }Then in my
home.tsionViewDidLoad() { this.adsProvider.retrieveAds().subscribe(results => { this.ads = results; }); this.adsProvider.retrieveThumbInAds(this.ads).subscribe(results => { ---> this is wrong, how to correct it? this.thumbs = results; }); }Then in my
home.html<ion-card [@fadeIn]="fade" class="category-card" *ngFor="let item of ads"> <img src="{{item.shop_thumbnail}}" /> ----> this is wrong <ion-icon name="md-heart" (click)="activeLike(item)" [ngClass]="{'activeColor':item.like}" class="like-icon" color="light"></ion-icon> <div class="card-title" (click)="goDetailPage(item.detail)" text-uppercase> <h4 color="secondary">{{item.title.rendered}}</h4> <p color="dark">{{item.price}}</p> <p class="excerpt" [innerHtml]="item.excerpt.rendered"> </p> </div> </ion-card>I have to problems in my code, the first being I don’t know how to pass the id to the second method, the second problem is how to iterate the thumbnails in the template since they are a different array? should I combine both arrays into one?
Posts: 2
Participants: 2