Je vous montre comment j'ai essayé de faire ça.
ts:
html:Code:
1
2
3
4
5
6
7
8
9
10
11
12 alternativeProducts(categories:any) { this.http.get('http://127.0.0.1:8001/api/products/liste/'+ categories) .subscribe((dataApi:any) =>{ this.products = dataApi.map(p=>({ image: p.image, name: p.name, description: p.description })); console.log(dataApi); console.log("products", this.products); }) }
Code:
1
2
3
4
5
6
7 <ion-slides [options]="option" margin="ion-margin-top"> <ion-slide *ngFor="let product of products"> <img id="myimage" [src]='product.image' /> {{ product.name }} {{ product.description}} </ion-slide> </ion-slides>
screen résultat:
Pièce jointe 623539