How to get multiple image from the server in ionic app?


Hello, I want to get multiple images from the server in my app. So for this, I tried this code:

<div class="one-image" *ngFor="let image of [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]">
<img src="{{image}}.jpg">

Here I have a working code, this way everything working fine but if I have more then 100 images in a folder at that time what to do? every time write image number is not good or is there any way to get all image from a folder in app…please help :slight_smile:


try assigning the array or json data from your server to a variable and then try using *ngFor

var imagedata:any={}
declare your variable globaly
and assign the value you get from your server to your variable then iterate them

1 Like

IN TypeScript:

images:any=“your server url”,data,options)
.map(res => res.json())
.subscribe(res => {
(err) =>