I am completely new to the world of Ionic development.
Currently, I am working on a simple Ionic application that comprises a list of users with their respective usernames and images stored in an array.
Typescript:
users = [
{
"name": "First User",
"image": [
"https://ionicframework.com/img/ionic-logo-blog.png", "https://ionicframework.com/img/ionic_logo.svg", "https://ionicframework.com/img/ionic-logo-blog.png"
]
},
{
"name": "Second User",
"image": [
"https://ionicframework.com/img/ionic-logo-blog.png", "https://ionicframework.com/img/ionic_logo.svg", "https://ionicframework.com/img/ionic-logo-blog.png"
]
},
{
"name": "Third User",
"image": [
"https://ionicframework.com/img/ionic-logo-blog.png", "https://ionicframework.com/img/ionic_logo.svg", "https://ionicframework.com/img/ionic-logo-blog.png"
]
},
]
HTML:
<div *ngFor="let user of users">
<span> {{ user.name }} </span>
<button ion-button type="button" (click)="openDocument(user.image)"> View Image </button>
<br>
</div>
Live Example: https://stackblitz.com/edit/ionic-1tzycv
In the example above, there is a button labeled View Image
. When clicked, I aim to display each image in a modal window sequentially with next and previous buttons to navigate through them.
I have scoured various resources but have not found a solution for displaying multiple images from an array within a modal as demonstrated in this code snippet:
this.modalCtrl.create(SomePage, {}, { enableBackdropDismiss: false }).present();
How can I achieve this functionality where upon clicking the View Image
button, a modal opens showing all the images one by one with options to navigate via next and previous buttons?
I am looking for something similar to this reference implementation: https://codepen.io/anon/pen/NoGVGb, however, I need it specifically tailored for Angular 6 with Ionic 3.