我试图在唯一页面上链接几个Json链接,并为每个Json选择一个选项卡上的特定内容。
例如:
home.ts
getAmericaData(){
let data: Observable<any> = this.http.get(the link url json from America Music review);
data.subscribe(data =>{
this.reviews = data["Collections"].Review;
});
}
getFranceData(){
let data: Observable<any> = this.http.get(the link url json from France Music review);
data.subscribe(data =>{
this.reviews = data["Collections"].Review;
});
}
home.html(这是针对美国标签页)
<ion-list *ngSwitchCase="'reviews'">
<ion-card *ngFor="let review of reviews; let i=index;" [hidden]="i>11" (click)="showDetails(review)">
<ion-list>
<h3 *ngIf="!reviews.length">No Search Found</h3>
<ion-item>
<div class="my-content line-break">
<h2>{{review?.Title}}</h2>
<p>{{review?.ShortStory}}</p>
<button ion-button color="Yellow" item-end full>More</button>
</div>
</ion-item>
</ion-list>
</ion-card>
</ion-list>
正如你所看到的,我为美国Json链接做了它并且它完美地工作但是现在我应该怎么做标签法国?
谢谢!